summaryrefslogtreecommitdiff
path: root/drivers/hwmon/pmbus
AgeCommit message (Collapse)Author
2025-05-12hwmon: pmbus: mpq8785: Add support for MPM3695 familyPawel Dembicki
Add support for the Monolithic Power Systems MPM3695 family. It contains four devices with suffixes: -10, -20, -25 and -100. The device is PMBus compliant and shares characteristics with the MPM82504. MPM3695-25 has different VOLTAGE_SCALE_LOOP register size [11:0] and therefore needs to have a separate compatible entry. Tested with device tree based matching (MPM3695-10). Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> Link: https://lore.kernel.org/r/20250511035701.2607947-6-paweldembicki@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-05-12hwmon: pmbus: mpq8785: Add support for MPM82504Pawel Dembicki
Add support for the Monolithic Power Systems MPM82504 digital voltage regulator. MPM82504 uses PMBus direct format for voltage output. Tested with device tree based matching. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> Link: https://lore.kernel.org/r/20250511035701.2607947-5-paweldembicki@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-05-12hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio ↵Pawel Dembicki
configuration Implement support for setting the VOUT_SCALE_LOOP PMBus register based on an optional device tree property "mps,vout-fb-divider-ratio-permille". This allows the driver to provide the correct VOUT value depending on the feedback voltage divider configuration for chips where the bootloader does not configure the VOUT_SCALE_LOOP register. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> Link: https://lore.kernel.org/r/20250511035701.2607947-4-paweldembicki@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-05-12hwmon: pmbus: mpq8785: Prepare driver for multiple device supportPawel Dembicki
Refactor the driver to support multiple Monolithic Power Systems devices. Introduce chip ID handling based on device tree matching. No functional changes intended. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> Link: https://lore.kernel.org/r/20250511035701.2607947-3-paweldembicki@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-04-23hwmon: (pmbus/lt3074) add support for lt3074Cedric Encarnacion
Add hardware monitoring and regulator support for LT3074. The LT3074 is an ultrafast, ultralow noise 3A, 5.5V dropout linear regulator. The PMBus serial interface allows telemetry for input/output voltage, bias voltage, output current, and die temperature. Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com> Link: https://lore.kernel.org/r/20250421-upstream-lt3074-v3-2-71636322f9fe@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-04-23hwmon: (max34451) Work around lost pageWilliam A. Kennington III
When requesting new pages from the max34451 we sometimes see that the firmware responds with stale or bad data to reads that happen immediately after a page change. This is due to a lack of clock stretching after page changing on the device side when it needs more time to complete the operation. To remedy this, the manufacturer recommends we wait 50us until the firmware should be ready with the new page. Signed-off-by: William A. Kennington III <william@wkennington.com> Link: https://lore.kernel.org/r/20250408011006.1314622-1-william@wkennington.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-04-23hwmon: (pmbus) Do not set regulators_node for single-channel chipsGuenter Roeck
Single-channel regulators do not need and should not have a "regulators" node. We can not entirely remove it due to existing bindings. To solve the problem for new drivers, provide additional macros PMBUS_REGULATOR_ONE_NODE and PMBUS_REGULATOR_STEP_ONE_NODE and convert existing drivers to use those macros. The exception is the ir38064 driver because its devicetree files and its description do not require or use the nested regulators node. Modify PMBUS_REGULATOR_STEP_ONE and PMBUS_REGULATOR_ONE to set the regulators_node pointer to NULL. Cc: Cedricjustine.Encarnacion@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250322142602.560042-1-linux@roeck-us.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-04-23hwmon: (pmbus/max34440) Add support for ADPM12160Alexis Czezar Torreno
ADPM12160 is a quarter brick DC/DC Power Module. It is a high power non-isolated converter capable of delivering a fully regulated 12V, with continuous power level of 1600W with peak power at 2400W for a limited time. Uses PMBus Configuration. Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> Link: https://lore.kernel.org/r/20250407-dev_adpm12160-v3-2-9cd3095445c8@analog.com [groeck: The chip is "ADPM12160"] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-04-23hwmon: (pmbus/max34440) Fix support for max34451Alexis Czezar Torreno
The max344** family has an issue with some PMBUS address being switched. This includes max34451 however version MAX34451-NA6 and later has this issue fixed and this commit supports that update. Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com> Link: https://lore.kernel.org/r/20250407-dev_adpm12160-v3-1-9cd3095445c8@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-04-23hwmon: (pmbus/ucd9000) Use new GPIO line value setter callbacksBartosz Golaszewski
struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-hwmon-v1-2-1fa38f34dc07@linaro.org Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-04-23hwmon: (pmbus) Introduce page_change_delayWilliam A. Kennington III
We have some buggy pmbus devices that require a delay after performing a page change operation before trying to issue more commands to the device. This allows for a configurable delay after page changes, but not affecting other read or write operations. This makes a slight behavioral tweak to the existing delay logic, where it considers the longest of delays between operations, instead of always chosing the write delay over the access delay. Signed-off-by: William A. Kennington III <william@wkennington.com> Link: https://lore.kernel.org/r/20250407201002.1198092-1-william@wkennington.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-25Merge tag 'hwmon-for-v6.15' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: "New drivers: - Driver for HTU31 - Congatec Board Controller monitoring driver - Driver for TI INA233 Current and Power Monitor Support for additional chips or boards in existing drivers: - pmbus/ltc2978: Add support for LT717x and LTM4673 - asus-ec-sensors: Add PRIME X670E-PRO WIFI - k10temp: Add support for cyan skillfish - nct6683: Add customer ID for AMD BC-250 - lm90: Add support for NCT7716, NCT7717 and NCT7718 Other notable improvements in existing drivers: - emc2305: Add devicetree support, and use devm_thermal_of_cooling_device_register - acpi_power_meter: Convert to with_info API - dell-smm: Increase the number of fans - pmbus/core: Optimize debugfs support and use i2c_client debugfs directory - hwmon core: Fix the missing of 'average' word in hwmon_power_attr_templates - Various drivers: Use per-client debugfs entry provided by I2C subsystem" * tag 'hwmon-for-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (49 commits) hwmon: emc2305: Use devm_thermal_of_cooling_device_register hwmon: emc2305: Add OF support dt-bindings: hwmon: Add Microchip emc2305 support dt-bindings: hwmon: Drop stray blank line in the header hwmon: (acpi_power_meter) Replace the deprecated hwmon_device_register hwmon: add driver for HTU31 dt-bindings: hwmon: Add description for sensor HTU31 hwmon: Add driver for TI INA233 Current and Power Monitor dt-bindings: hwmon: ti,ina2xx: Add INA233 device hwmon: Add Congatec Board Controller monitoring driver hwmon: (pmbus/ltc2978) add support for lt717x dt-bindings: hwmon: ltc2978: add support for LT717x hwmon: (pmbus/ltc2978) Add support for LT717x - docs hwmon: (dell-smm) Increment the number of fans hwmon: (ntc_thermistor) return error instead of clipping on OOB hwmon: (pt5161l) Use per-client debugfs entry hwmon: Fix the missing of 'average' word in hwmon_power_attr_templates hwmon: (acpi_power_meter) Fix the fake power alarm reporting hwmon: (gpio-fan) Add missing mutex locks dt-bindings: hwmon: gpio-fan: Add optional regulator support ...
2025-03-18hwmon: Add driver for TI INA233 Current and Power MonitorLeo Yang
Driver for Texas Instruments INA233 Current and Power Monitor With I2C-, SMBus-, and PMBus-Compatible Interface Signed-off-by: Leo Yang <leo.yang.sy0@gmail.com> Link: https://lore.kernel.org/r/20250116085939.1235598-3-leo.yang.sy0@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-17hwmon: (pmbus/ltc2978) add support for lt717xKim Seer Paller
Add support for LT7170 and LT7171. The LT7170 and LT7171 are 20 A, 16 V, Single- or Dual-Phase, Silent Switcher Step-Down Regulators with Digital Power System Management. The relevant registers in the LT7170 and LT7171 are similar to those in the LTC3887, but with fewer channels. This adds the chip ID and identification of ASCII to differentiate between the LT7170 and LT7171. These devices support polling for status updates and clearing peak values. The data format for voltage, current, and temperature is set to IEEE754 for precision and compatibility. Co-developed-by: Cherrence Sarip <cherrence.sarip@analog.com> Signed-off-by: Cherrence Sarip <cherrence.sarip@analog.com> Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com> Link: https://lore.kernel.org/r/20250317-hwmon-next-v1-3-da0218c38197@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-02hwmon: (pmbus/core) Report content of CAPABILITY register in debugfsGuenter Roeck
Report the value of the CAPABILITY register in debugfs if supported. Only check if the register is supported if PMBUS_NO_CAPABILITY is not set. Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-02hwmon: (pmbus/core) Optimize debugfs status attribute initializationGuenter Roeck
Define debugfs attributes used to access status registers in a data structure and loop through it instead of creating debugfs files one by one. This reduces code size and simplifies adding additional attributes if needed. Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-02hwmon: (pmbus/core) Optimize debugfs block data attribute initializationGuenter Roeck
Define debugfs attributes which need block data access in a data structure and loop through it instead of creating debugfs files one by one. This reduces code size and simplifies adding additional attributes if needed. While this is currently only used for manufacturer specific attributes, the access code is generic and also works for other block attributes, so rename operation functions from _mfg to _block. While at it, rename the "revison" file to "pmbus_revision" to make its meaning more obvious and to create a clear distinction against the "mfg_revision" file. Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-02hwmon: (pmbus/core) Declare regulator notification function as voidGuenter Roeck
The regulator notification function never returns an error. Declare it as void. While at it, fix its indentation. No functional change. Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-02hwmon: (pmbus/core) Make debugfs code unconditionalGuenter Roeck
Drop contitionals around debugfs code to compile it unconditionally. In practice it will be optimized away by the compiler if CONFIG_DEBUG_FS is not enabled, so the code size is not affected by this change. Also silently ignore errors if debugfs initialization fails. Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-02hwmon: (pmbus/core) Use the new i2c_client debugfs directoryGuenter Roeck
The I2C core now manages a debugfs directory per I2C client. PMBus has its own debugfs hierarchy. Link the two, so a user will be pointed to the I2C domain from the PMBus domain. Suggested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-02hwmon: (pmbus/core) Use local debugfs variable in debugfs initializationGuenter Roeck
In preparation for the next patch in the series, use a local debugfs variable during debugfs initialization. No functional change intended. Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-02hwmon: (pmbus/core) Fix various coding style issuesGuenter Roeck
Checkpatch reports bad multi-line comments, bad multi-line alignments, missing blank lines after variable declarations, unnecessary empty lines, unnecessary spaces, and unnecessary braces. Fix most of the reported problems except for some multi-line alignment problems. Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-02hwmon: (pmbus/core) Replace deprecated strncpy() with strscpy()Thorsten Blum
strncpy() is deprecated for NUL-terminated destination buffers; use strscpy() instead. Compile-tested only. Note(groeck): strscpy() uses sizeof() to determine the length of the destination buffer if it is not provided as argument. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://lore.kernel.org/r/20250227173936.7746-2-thorsten.blum@linux.dev Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-03-02hwmon: (pmbus) Initialise page count in pmbus_identify()Titus Rwantare
The `pmbus_identify()` function fails to correctly determine the number of supported pages on PMBus devices. This occurs because `info->pages` is implicitly zero-initialised, and `pmbus_set_page()` does not perform writes to the page register if `info->pages` is not yet initialised. Without this patch, `info->pages` is always set to the maximum after scanning. This patch initialises `info->pages` to `PMBUS_PAGES` before the probing loop, enabling `pmbus_set_page()` writes to make it out onto the bus correctly identifying the number of pages. `PMBUS_PAGES` seemed like a reasonable non-zero number because that's the current result of the identification process. Testing was done with a PMBus device in QEMU. Signed-off-by: Titus Rwantare <titusr@google.com> Fixes: 442aba78728e7 ("hwmon: PMBus device driver") Link: https://lore.kernel.org/r/20250227222455.2583468-1-titusr@google.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-02-02hwmon: (pmbus/ltc2978) add support for ltm4673Cedric Encarnacion
Add support for LTM4673. The LTM4673 is a quad output, dual 12A and dual 5A, switching mode DC/DC step-down μModule regulator integrated with 4-channel power system manager. This adds only the chip id, the checks for the manufacturer special id, and the relevant attributes for the device's pmbus_driver_info. The device does not support clear peaks. Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com> Link: https://lore.kernel.org/r/20250124-ltm4673-v1-2-a2c6aa37c903@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2025-01-13hwmon: pmbus: dps920ab: Add ability to instantiate through i2cDenis Kirjanov
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-08hwmon: (pmbus/max15301) Add support for MAX15303Nuno Sa
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-07hwmon: (pmbus/adm1275) add adm1273 supportJohn Erasmus Mari Geronimo
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>
2024-12-18hwmon: (pmbus/crps) Add Intel CRPS185 power supplyNinad Palsule
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-16hwmon: (pmbus/core) Add PMBUS_REVISION in debugfsNinad Palsule
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-14hwmon: (pmbus/tps25990) Add initial supportJerome Brunet
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 Brunet
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>
2024-12-14hwmon: (pmbus/core) improve handling of write protected regulatorsJerome Brunet
Writing PMBus protected registers does succeed from the smbus perspective, even if the write is ignored by the device and a communication fault is raised. This fault will silently be caught and cleared by pmbus irq if one has been registered. This means that the regulator call may return succeed although the operation was ignored. With this change, the operation which are not supported will be properly flagged as such and the regulator framework won't even try to execute them. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> [groeck: Adjust to EXPORT_SYMBOL_NS_GPL API change] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-12-02module: Convert symbol namespace to string literalPeter Zijlstra
Clean up the existing export namespace code along the same lines of commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo) to __section("foo")") and for the same reason, it is not desired for the namespace argument to be a macro expansion itself. Scripted using git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file; do awk -i inplace ' /^#define EXPORT_SYMBOL_NS/ { gsub(/__stringify\(ns\)/, "ns"); print; next; } /^#define MODULE_IMPORT_NS/ { gsub(/__stringify\(ns\)/, "ns"); print; next; } /MODULE_IMPORT_NS/ { $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g"); } /EXPORT_SYMBOL_NS/ { if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) { if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ && $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ && $0 !~ /^my/) { getline line; gsub(/[[:space:]]*\\$/, ""); gsub(/[[:space:]]/, "", line); $0 = $0 " " line; } $0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/, "\\1(\\2, \"\\3\")", "g"); } } { print }' $file; done Requested-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc Acked-by: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-11-13hwmon: (pmbus/isl68137) add support for voltage divider on VoutGrant Peltier
Some applications require Vout to be higher than the detectable voltage range of the Vsense pin for a given rail. In such applications, a voltage divider may be placed between Vout and the Vsense pin, but this results in erroneous telemetry being read back from the part. This change adds support for a voltage divider to be defined in the devicetree for a (or multiple) specific rail(s) for a supported digital multiphase device and for the applicable Vout telemetry to be scaled based on the voltage divider configuration. This change copies the implementation of the vout-voltage-divider devicetree property defined in the maxim,max20730 bindings schema since it is the best fit for the use case of scaling hwmon PMBus telemetry. The generic voltage-divider property used by many iio drivers was determined to be a poor fit because that schema is tied directly to iio and the isl68137 driver is not an iio driver. Signed-off-by: Grant Peltier <grantpeltier93@gmail.com> Message-ID: <8c2d048f87282bcf66313afbf5e923d8fc17b4d7.1731439797.git.grantpeltier93@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-11-12hwmon: (pmbus/core) clear faults after setting smbalert maskJerome Brunet
pmbus_write_smbalert_mask() ignores the errors if the chip can't set smbalert mask the standard way. It is not necessarily a problem for the irq support if the chip is otherwise properly setup but it may leave an uncleared fault behind. pmbus_core will pick the fault on the next register_check(). The register check will fails regardless of the actual register support by the chip. This leads to missing attributes or debugfs entries for chips that should provide them. We cannot rely on register_check() as PMBUS_SMBALERT_MASK may be read-only. Unconditionally clear the page fault after setting PMBUS_SMBALERT_MASK to avoid the problem. Suggested-by: Guenter Roeck <linux@roeck-us.net> Fixes: 221819ca4c36 ("hwmon: (pmbus/core) Add interrupt support") Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Message-ID: <20241105-tps25990-v4-5-0e312ac70b62@baylibre.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-11-12hwmon: (pmbus/core) allow drivers to override WRITE_PROTECTJerome Brunet
Use _pmbus_read_byte_data() rather than calling smbus directly to check the write protection status. This give a chance to device implementing write protection differently to report back on the actual write protection status. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Message-ID: <20241105-tps25990-v4-2-0e312ac70b62@baylibre.com> [groeck: Fix page parameter of _pmbus_read_byte_data()] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-11-10hwmon: (pmbus/ltc2978) add support for ltc7841Mariel Tinaco
Add support for LTC7841. The LTC7841 is a high performance PolyPhase® single output synchronous boost converter controller. Multiphase operation reduces input and output capacitor requirements and allows the use of smaller inductors than the single-phase equivalent. The relevant registers in the LTC7841 are similar to the LTC7880, only reduced by some amount. So it's just a matter of adding the chip id. The device also doesn't support polling, on top of the reduced register set, so a separate case for setting the chip info is added. Signed-off-by: Mariel Tinaco <Mariel.Tinaco@analog.com> Message-ID: <20241029013734.293024-4-Mariel.Tinaco@analog.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-11-10hwmon: (pmbus/mpq8785) Convert comma to semicolonShen Lichuan
To ensure code clarity and prevent potential errors, use ';' instead of ',' as a statement separator in the function mpq8785_identify. Signed-off-by: Shen Lichuan <shenlichuan@vivo.com> Message-ID: <20240919064939.3282-1-shenlichuan@vivo.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-11-10hwmon: Drop explicit initialization of struct i2c_device_id::driver_data to 0Uwe Kleine-König
These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member. 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. While touching these structs, also remove commas after the sentinel entries and use a consistent indention style. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Message-ID: <20240918123150.1540161-7-u.kleine-koenig@baylibre.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-09-18Merge tag 'hwmon-for-v6.12' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: "New drivers: - driver for Sophgo SG2042 external hardware monitor - thermal sensor driver for Surface Aggregator Module Added support to existing drivers: - oxp-sensors: Support for multiple new devices. - nct6775: Added G15CF to ASUS WMI monitoring list Modernizations: - driver cleanup and update to use with_info API: ina2xx, lm92, lm95234, max1619, max1668, and max6697. API updates: - removed unused devm_hwmon_device_unregister() API function Other notable changes - implement and use generic bus access delay for pmbus drivers - use with scoped for each OF child loop in several drivers - module unloading fixes for gsc-hwmon and ntc_thermistor drivers - converted various drivers to use multi-byte regmap operations - adt7475: Improved devicetree based configuration - ltc2947: Move to firmware agnostic API - ltc2978: Converted devicetree description to yaml - max16065: Addressed overflows when writing limit attributes Various other minor cleanups, fixes and improvements" * tag 'hwmon-for-v6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (96 commits) hwmon: Remove devm_hwmon_device_unregister() API function hwmon: (sch5636) Print unknown ID in error string via %*pE hwmon: (sht21) Use %*ph to print small buffer hwmon: (pmbus/mpq7932) Constify struct regulator_desc hwmon: pmbus: pli12096bc: Add write delay hwmon: pmbus: zl6100: Use generic code hwmon: pmbus: ucd9000: Use generic code hwmon: pmbus: max15301: Use generic code hwmon: pmbus: Implement generic bus access delay hwmon: (ina2xx) Use shunt voltage to calculate current hwmon: (ina2xx) Add support for current limits hwmon: (ina2xx) Pass register to alert limit write functions hwmon: (ina2xx) Convert to use with_info hwmon API hwmon: (ina2xx) Move ina2xx_get_value() hwmon: (ina2xx) Set alert latch hwmon: (ina2xx) Consolidate chip initialization code hwmon: (ina2xx) Fix various overflow issues hwmon: (ina2xx) Re-initialize chip using regmap functions hwmon: (ina2xx) Use local regmap pointer if used more than once hwmon: (ina2xx) Mark regmap_config as const ...
2024-09-09hwmon: (pmbus) Conditionally clear individual status bits for pmbus rev >= 1.2Patryk Biel
The current implementation of pmbus_show_boolean assumes that all devices support write-back operation of status register to clear pending warnings or faults. Since clearing individual bits in the status registers was only introduced in PMBus specification 1.2, this operation may not be supported by some older devices. This can result in an error while reading boolean attributes such as temp1_max_alarm. Fetch PMBus revision supported by the device and modify pmbus_show_boolean so that it only tries to clear individual status bits if the device is compliant with PMBus specs >= 1.2. Otherwise clear all fault indicators on the current page after a fault status was reported. Fixes: 35f165f08950a ("hwmon: (pmbus) Clear pmbus fault/warning bits after read") Signed-off-by: Patryk Biel <pbiel7@gmail.com> Message-ID: <20240909-pmbus-status-reg-clearing-v1-1-f1c0d68c6408@gmail.com> [groeck: Rewrote description Moved revision detection code ahead of clear faults command Assigned revision if return value from PMBUS_REVISION command is 0 Improved return value check from calling _pmbus_write_byte_data()] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-09-08hwmon: (pmbus/mpq7932) Constify struct regulator_descChristophe JAILLET
'struct regulator_desc' is not modified in this driver. Constifying this structure moves some data to a read-only section, so increase overall security, especially when the structure holds some function pointers. This also makes mpq7932_regulators_desc consistent with mpq7932_regulators_desc_one which is already a "static const struct regulator_desc". On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 3516 2264 0 5780 1694 drivers/hwmon/pmbus/mpq7932.o After: ===== text data bss dec hex filename 5396 384 0 5780 1694 drivers/hwmon/pmbus/mpq7932.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Message-ID: <c0585a07547ec58d99a5bff5e02b398114bbe312.1725784343.git.christophe.jaillet@wanadoo.fr> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-09-02hwmon: pmbus: pli12096bc: Add write delayPatrick Rudolph
Tests on PLI12096bc showed that sometimes a small delay is necessary after a write operation before a new operation can be processed. If not respected the device will probably NACK the data phase of the SMBus transaction. Tests showed that the probability to observe transaction errors can be raised by either reading sensor data or toggling the regulator enable. Further tests showed that 250 microseconds, as used previously for the CLEAR_FAULTS workaround, is sufficient. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Message-ID: <20240902075319.585656-5-patrick.rudolph@9elements.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-09-02hwmon: pmbus: zl6100: Use generic codePatrick Rudolph
Use generic pmbus bus access delay. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Message-ID: <20240902075319.585656-4-patrick.rudolph@9elements.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-09-02hwmon: pmbus: ucd9000: Use generic codePatrick Rudolph
Use generic pmbus bus write access delay. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Message-ID: <20240902075319.585656-3-patrick.rudolph@9elements.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-09-02hwmon: pmbus: max15301: Use generic codePatrick Rudolph
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>
2024-09-02hwmon: pmbus: Implement generic bus access delayPatrick Rudolph
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>
2024-07-10hwmon: (pmbus/ltc4286) Drop unused i2c device idsUwe Kleine-König
The driver doesn't make use of the different numbers assigned to the different devices. So drop them. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/9a48ba0368e0c8cddc94c5e4cf3edd7eadc03a2d.1720600141.git.u.kleine-koenig@baylibre.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-02hwmon: add MP5920 driverAlex Vdovydchenko
Add support for MPS Hot-Swap controller mp5920. This driver exposes telemetry and limit value readings and writings. Signed-off-by: Alex Vdovydchenko <xzeol@yahoo.com> Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20240702115252.981416-3-xzeol@yahoo.com [groeck: Use min_t() to limit length of displayed model string] Signed-off-by: Guenter Roeck <linux@roeck-us.net>