summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pmbus
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: (pmbus/core) Implement regulator get_statusPatrick Rudolph2022-12-041-0/+44
| | | | | | | | | Add get_status for pmbus_regulator_ops. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com> Link: https://lore.kernel.org/r/20221124193642.4081054-1-Naresh.Solanki@9elements.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add power good supportPatrick Rudolph2022-12-041-2/+6
| | | | | | | | | | Update error flags with regulation out if regulator is on & power good status bit is set Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com> Link: https://lore.kernel.org/r/20221117184022.1808508-1-Naresh.Solanki@9elements.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: Include <linux/kstrtox.h> when appropriateChristophe JAILLET2022-12-041-0/+1
| | | | | | | | | | | The kstrto<something>() functions have been moved from kernel.h to kstrtox.h. So, include the latter directly in the appropriate files. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/51688cf50bda44e2731381a31287c62319388783.1667763218.git.christophe.jaillet@wanadoo.fr Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/ltc2978) add support for LTC7132Felix Nieuwenhuizen2022-12-041-6/+11
| | | | | | | | | | Add support for LTC7132. The relevant registers in the LTC7132 are identical to the LTC7880. So it's just a matter of adding the chip id. Signed-off-by: Felix Nieuwenhuizen <Felix.Nieuwenhuizen@etas.com> Link: https://lore.kernel.org/r/20221027145135.31802-1-Felix.Nieuwenhuizen@etas.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* Revert "hwmon: (pmbus) Add regulator supply into macro"Guenter Roeck2022-11-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 54cc3dbfc10dc3db7cb1cf49aee4477a8398fbde. Zev Weiss reports that the reverted patch may cause a regulator undercount. Here is his report: ... having regulator-dummy set as a supply on my PMBus regulators (instead of having them as their own top-level regulators without an upstream supply) leads to enable-count underflow errors when disabling them: # echo 0 > /sys/bus/platform/devices/efuse01/state [ 906.094477] regulator-dummy: Underflow of regulator enable count [ 906.100563] Failed to disable vout: -EINVAL [ 136.992676] reg-userspace-consumer efuse01: Failed to configure state: -22 Zev reports that reverting the patch fixes the problem. So let's do that for now. Fixes: 54cc3dbfc10d ("hwmon: (pmbus) Add regulator supply into macro") Cc: Marcello Sylvester Bauer <sylv@sylv.io> Reported-by: Zev Weiss <zev@bewilderbeest.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* Merge tag 'hwmon-for-v6.1' of ↵Linus Torvalds2022-10-044-7/+87
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: "New drivers: - Driver for MAX31760 fan speed controller - Driver for TEXAS TPS546D24 Buck Converter - Driver for EMC2301/2/3/5 RPM-based PWM Fan Speed Controller Removed drivers: - Drop obsolete asus_wmi_ec_sensors driver Cleanups, affecting various drivers: - Use DEFINE_SIMPLE_DEV_PM_OPS where appropriate - Remove forward declarations - Move from strlcpy with unused retval to strscpy - Make use of devm_clk_get_enabled() - Drop devm_of_pwm_get() Other notable cleanup and improvements: - Support for additional USB devide ID and support for reporting of rail mode via debugfs added to corsair-psu driver - Support for aditional USB ID in nzxt-smart2 driver - Support for Aquacomputer High Flow Next in aquacomputer_d5next driver - Major cleanup of pwm-fan driver - Major cleanup of mr75203 driver, and added support for new device revision And various other minor fixes and cleanups" * tag 'hwmon-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (86 commits) hwmon: (corsair-psu) add USB id of new revision of the HX1000i psu hwmon: (pmbus/mp2888) Fix sensors readouts for MPS Multi-phase mp2888 controller dt-bindings: hwmon: sensirion,shtc1: Clean up spelling mistakes and grammar hwmon: (nct6683) remove unused variable in nct6683_create_attr_group hwmon: w83627hf: Reorder symbols to get rid of a few forward declarations hwmon: (ina3221) Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() hwmon: (w83627ehf) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (tmp108) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (tmp103) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (tmp102) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (pwm-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (nct6775) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (max6639) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (max31730) witch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (max31722) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (ltc2947) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (lm90) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (it87) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() ...
| * hwmon: (pmbus/mp2888) Fix sensors readouts for MPS Multi-phase mp2888 controllerOleksandr Shamray2022-10-021-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix scale factors for reading MPS Multi-phase mp2888 controller. Fixed sensors: - PIN/POUT: based on vendor documentation, set bscale factor 0.5W/LSB - IOUT: based on vendor documentation, set scale factor 0.25 A/LSB Fixes: e4db7719d037 ("hwmon: (pmbus) Add support for MPS Multi-phase mp2888 controller") Signed-off-by: Oleksandr Shamray <oleksandrs@nvidia.com> Reviewed-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20220929121642.63051-1-oleksandrs@nvidia.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pmbus) Add driver for the TEXAS TPS546D24 Buck Converter.Duke Du2022-09-253-0/+81
| | | | | | | | | | | | | | | | | | | | | | Add the pmbus driver for TEXAS tps546d24 Buck Converter. The vout mode of tps546d24 supported relative data format, which is not supported by the PMBus core. Signed-off-by: Duke Du <dukedu83@gmail.com> Link: https://lore.kernel.org/r/1662951668-9849-1-git-send-email-Duke.Du@quantatw.com [groeck: Add __maybe_unused to tps546d24_of_match declaration] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | Merge tag 'thermal-6.1-rc1' of ↵Linus Torvalds2022-10-031-5/+5
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull thermal control updates from Rafael Wysocki: "The most significant part of this update is the thermal control DT initialization rework from Daniel Lezcano and the following conversion of drivers to use the new API introduced by it Apart from that, the maximum number of trip points in a thermal zone is increased and there are some fixes and code cleanups Specifics: - Rework the device tree initialization, convert the drivers to the new API and remove the old OF code (Daniel Lezcano) - Fix return value to -ENODEV when searching for a specific thermal zone which does not exist (Daniel Lezcano) - Fix the return value inspection in of_thermal_zone_find() (Dan Carpenter) - Fix kernel panic when KASAN is enabled as it detects use after free when unregistering a thermal zone (Daniel Lezcano) - Move the set_trip ops inside the therma sysfs code (Daniel Lezcano) - Remove unnecessary error message as it is already shown in the underlying function (Jiapeng Chong) - Rework the monitoring path and move the locks upper in the call stack to fix some potentials race windows (Daniel Lezcano) - Fix lockdep_assert() warning introduced by the lock rework (Daniel Lezcano) - Do not lock thermal zone mutex in the user space governor (Rafael Wysocki) - Revert the Mellanox 'hotter thermal zone' feature because it is already handled in the thermal framework core code (Daniel Lezcano) - Increase maximum number of trip points in the thermal core (Sumeet Pawnikar) - Replace strlcpy() with unused retval with strscpy() in the core thermal control code (Wolfram Sang) - Use module_pci_driver() macro in the int340x processor_thermal driver (Shang XiaoJing) - Use get_cpu() instead of smp_processor_id() in the intel_powerclamp thermal driver to prevent it from crashing and remove unused accounting for IRQ wakes from it (Srinivas Pandruvada) - Consolidate priv->data_vault checks in int340x_thermal (Rafael Wysocki) - Check the policy first in cpufreq_cooling_register() (Xuewen Yan) - Drop redundant error message from da9062-thermal (zhaoxiao) - Drop of_match_ptr() from thermal_mmio (Jean Delvare)" * tag 'thermal-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (55 commits) thermal: core: Increase maximum number of trip points thermal: int340x: processor_thermal: Use module_pci_driver() macro thermal: intel_powerclamp: Remove accounting for IRQ wakes thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash thermal: int340x_thermal: Consolidate priv->data_vault checks thermal: cpufreq_cooling: Check the policy first in cpufreq_cooling_register() thermal: Drop duplicate words from comments thermal: move from strlcpy() with unused retval to strscpy() thermal: da9062-thermal: Drop redundant error message thermal/drivers/thermal_mmio: Drop of_match_ptr() thermal: gov_user_space: Do not lock thermal zone mutex Revert "mlxsw: core: Add the hottest thermal zone detection" thermal/core: Fix lockdep_assert() warning thermal/core: Move the mutex inside the thermal_zone_device_update() function thermal/core: Move the thermal zone lock out of the governors thermal/governors: Group the thermal zone lock inside the throttle function thermal/core: Rework the monitoring a bit thermal/core: Rearm the monitoring only one time thermal/drivers/qcom/spmi-adc-tm5: Remove unnecessary print function dev_err() thermal/of: Remove old OF code ...
| * hwmon: pm_bus: core: Switch to new of thermal APIDaniel Lezcano2022-08-171-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org> Link: https://lore.kernel.org/r/20220804224349.1926752-27-daniel.lezcano@linexp.org Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
* | hwmon: (pmbus) Fix vout margin cachingVincent Whitchurch2022-08-171-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | The code currently uses a zero margin to mean not cached, but this results in the cache being bypassed if the (low) margin is set to zero, leading to lots of unnecessary SMBus transactions in that case. Use a negative value instead. Fixes: 07fb76273db89d93 ("hwmon: (pmbus) Introduce and use cached vout margins") Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com> Link: https://lore.kernel.org/r/20220816144414.2358974-1-vincent.whitchurch@axis.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (pmbus) Use dev_err_probe() to filter -EPROBE_DEFER error messagesChristophe JAILLET2022-08-171-5/+4
|/ | | | | | | | | | | devm_regulator_register() can return -EPROBE_DEFER, so better use dev_err_probe() instead of dev_err(), it is less verbose in such a case. It is also more informative, which can't hurt. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/3adf1cea6e32e54c0f71f4604b4e98d992beaa71.1660741419.git.christophe.jaillet@wanadoo.fr Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/ltc2978) Set voltage resolutionMårten Lindahl2022-07-132-6/+46
| | | | | | | | | | | | | | | | The LTC2977 regulator does not set the regulator_desc .n_voltages value which is needed in order to let the regulator core list the regulator voltage range. This patch defines a regulator_desc with a voltage range, and uses it for defining voltage resolution for regulators LTC2972/LTC2974/LTC2975/ LTC2977/LTC2978/LTC2979/LTC2980/LTM2987 based on that they all have a 16 bit ADC with the same stepwise 122.07uV resolution. It also scales the resolution to a 1mV resolution which is easier to handle. Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Link: https://lore.kernel.org/r/20220614095144.3472305-1-marten.lindahl@axis.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add list_voltage to pmbus opsMårten Lindahl2022-07-131-0/+30
| | | | | | | | | | | | When checking if a regulator supports a voltage range, the regulator needs to have a list_voltage callback set to the regulator_ops or else -EINVAL will be returned. This support does not exist for the pmbus regulators, so this patch adds pmbus_regulator_list_voltage to the pmbus_regulator_ops. Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Link: https://lore.kernel.org/r/20220614093856.3470672-3-marten.lindahl@axis.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Introduce and use cached vout marginsMårten Lindahl2022-07-131-17/+61
| | | | | | | | | | | | | | | | When setting a new voltage the voltage boundaries are read every time to check that the new voltage is within the proper range. Checking these voltage boundaries consists of reading one of PMBUS_MFR_VOUT_MIN/ PMBUS_VOUT_MARGIN_LOW registers and then PMBUS_MFR_VOUT_MAX/ PMBUS_VOUT_MARGIN_HIGH together with writing the PMBUS_CLEAR_FAULTS register. Since these boundaries are never being changed, it can be cached and thus saving unnecessary smbus transmissions. Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Link: https://lore.kernel.org/r/20220614093856.3470672-2-marten.lindahl@axis.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) fix build error unused-functionRen Zhijie2022-07-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | If CONFIG_PMBUS is y and CONFIG_DEBUG_FS is not set. make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will be failed, like this: drivers/hwmon/pmbus/pmbus_core.c:593:13: error: ‘pmbus_check_block_register’ defined but not used [-Werror=unused-function] static bool pmbus_check_block_register(struct i2c_client *client, int page, ^~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[3]: *** [drivers/hwmon/pmbus/pmbus_core.o] Error 1 make[2]: *** [drivers/hwmon/pmbus] Error 2 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [drivers/hwmon] Error 2 make[1]: *** Waiting for unfinished jobs.... make: *** [drivers] Error 2 To fix building warning, use __maybe_unused to attach this func. Reported-by: Hulk Robot <hulkci@huawei.com> Fixes: c3ffc3a1ff83("hwmon: (pmbus) add a function to check the presence of a block register") Signed-off-by: Ren Zhijie <renzhijie2@huawei.com> Link: https://lore.kernel.org/r/20220609120448.139907-1-renzhijie2@huawei.com [groeck: Fixed continuation line alignment] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) add MFR_* registers to debugfsAdam Wujek2022-07-131-2/+97
| | | | | | | | | | | | | | | | | | | Add registers to debugfs: PMBUS_MFR_ID PMBUS_MFR_MODEL PMBUS_MFR_REVISION PMBUS_MFR_LOCATION PMBUS_MFR_DATE PMBUS_MFR_SERIAL To reduce the number of debugfs entries, only values from page 0 are reported. It is assumed that values of these registers are the same for all pages. Please note that the PMBUS standard allows added registers to be page-specific. Signed-off-by: Adam Wujek <dev_public@wujek.eu> Link: https://lore.kernel.org/r/20220601013232.801133-2-dev_public@wujek.eu Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) add a function to check the presence of a block registerAdam Wujek2022-07-131-0/+28
| | | | | | | | | | Other functions (like pmbus_check_byte_register) cannot be used to check the presence of a block register, because it will generate error when PEC is used. Signed-off-by: Adam Wujek <dev_public@wujek.eu> Link: https://lore.kernel.org/r/20220601013232.801133-1-dev_public@wujek.eu Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add support for Analog Devices LT7182SGuenter Roeck2022-07-133-0/+205
| | | | | | | Add support for Analog Devices LT7182S Dual Channel 6A, 20V PolyPhase Step-Down Silent Switcher with Digital Power System Management. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add IEEE 754 half precision support to PMBus coreGuenter Roeck2022-07-132-5/+139
| | | | | | | Add support for the IEEE 754 half precision data format as specified in PMBus v1.3.1. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Move pec attribute to I2C deviceGuenter Roeck2022-07-131-39/+50
| | | | | | | | | | | Enabling and disabling PEC for PMBus devices is currently only supported with a debugfs attribute, which requires debugfs to be enabled and is thus less than perfect. Take the lm90 driver as example and add a 'pec' attribute to the I2C device if both the I2C adapter and the PMBus device support it. Remove the now obsolete 'pec' attribute from debugfs. Cc: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/ucd9200) fix typos in commentsJiang Jian2022-06-291-1/+1
| | | | | | | | | | | | | | | | Drop the redundant word 'the' in the comments following /* * Set PHASE registers on all pages to 0xff to ensure that phase * specific commands will apply to all phases of a given page (rail). * This only affects the READ_IOUT and READ_TEMPERATURE2 registers. * READ_IOUT will return the sum of currents of all phases of a rail, * and READ_TEMPERATURE2 will return the maximum temperature detected * for the [the - DROP] phases of the rail. */ Signed-off-by: Jiang Jian <jiangjian@cdjrlc.com> Link: https://lore.kernel.org/r/20220622063231.20612-1-jiangjian@cdjrlc.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Check PEC support before reading other registersAdam Wujek2022-05-221-13/+15
| | | | | | | | | | | | | | | | | | | | | | Make sure that the support of PEC is determined before the read of other registers. Otherwise the validation of PEC can trigger an error on the read of STATUS_BYTE or STATUS_WORD registers. The problematic scenario is the following. A device with enabled PEC support is up and running and a kernel driver is loaded. Then the driver is unloaded (or device unbound), the HW device is reconfigured externally (e.g. by i2cset) to advertise itself as not supporting PEC. Without the move of the code, at the second load of the driver (or bind) the STATUS_BYTE or STATUS_WORD register is always read with PEC enabled, which is likely to cause a read error resulting with fail of a driver load (or bind). Signed-off-by: Adam Wujek <dev_public@wujek.eu> Link: https://lore.kernel.org/r/20220519233334.438621-1-dev_public@wujek.eu Fixes: 75d2b2b06bd84 ("hwmon: (pmbus) disable PEC if not enabled") Fixes: 4e5418f787ec5 ("hwmon: (pmbus_core) Check adapter PEC support") [groeck: Added Fixes: tags, dropped continuation line] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add get_voltage/set_voltage opsMårten Lindahl2022-05-221-0/+67
| | | | | | | | | | The pmbus core does not have operations for getting or setting voltage. Add functions get/set voltage for the dynamic regulator framework. Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Link: https://lore.kernel.org/r/20220503104631.3515715-5-marten.lindahl@axis.com [groeck: cosmetic alignment / empty line fixes] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Register with thermal for PSC_TEMPERATUREEduardo Valentin2022-05-221-0/+68
| | | | | | | | | | | | | | | | | | | | | | Some pmbus device drivers have device tree support and may want to use of-thermal to register a thermal zone OF sensor for those device drivers. This way we allow describing device tree thermal zones for pmbus device drivers with device tree support. This patch achieves this by registering pmbus sensors with thermal subsystem if they are PSC_TEMPERATURE and are providing _input hwmon interface. Cc: Guenter Roeck <linux@roeck-us.net> (maintainer:PMBUS HARDWARE MONITORING DRIVERS) Cc: Jean Delvare <jdelvare@suse.com> (maintainer:HARDWARE MONITORING) Cc: linux-hwmon@vger.kernel.org (open list:PMBUS HARDWARE MONITORING DRIVERS) Cc: linux-kernel@vger.kernel.org (open list) Signed-off-by: Eduardo Valentin <eduval@amazon.com> Signed-off-by: Eduardo Valentin <evalenti@kernel.org> Link: https://lore.kernel.org/r/20220428174926.2150-1-eduval@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add support for Infineon Digital Multi-phase xdp152 family ↵Greg.Schwendimann@infineon.com2022-05-223-0/+85
| | | | | | | | | | controllers Add support for devices XDPE152C4, XDPE12584. Signed-off-by: Greg Schwendimann <Greg.Schwendimann@infineon.com> Link: https://lore.kernel.org/r/5e6d50e9b28140158f339b0de343eea4@infineon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/ltc2978) Add chip specific write_byte_dataMårten Lindahl2022-05-201-0/+12
| | | | | | | | | | | | | | | | | | | | | Several of the manuals for devices supported by this driver describes the need for a minimum wait time before the chip is ready to receive next command. This wait time is already implemented in the driver as a ltc_wait_ready function with a driver defined wait time of 100 ms, and is considered for specific devices before reading/writing data on the pmbus. Since this driver uses the default pmbus_regulator_ops for the enable/ disable/is_enabled functions we should add a driver specific callback for write_byte_data to prevent bypassing the wait time recommendations for the following devices: ltc3880/ltc3882/ltc3883/ltc3884/ltc3886/ ltc3887/ltc3889/ltm4664/ltm4675/ltm4676/ltm4677/ltm4678/ltm4680/ltm4686/ ltm4700/ltc7880. Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Link: https://lore.kernel.org/r/20220428144039.2464667-4-marten.lindahl@axis.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Use _pmbus_read_byte_data with callbackMårten Lindahl2022-05-201-23/+23
| | | | | | | | | | | | | Some of the pmbus core functions uses pmbus_read_byte_data, which does not support driver callbacks for chip specific write operations. This could potentially influence some specific regulator chips that for example need a time delay before each data access. Lets use _pmbus_read_byte_data with callback check. Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Link: https://lore.kernel.org/r/20220428144039.2464667-3-marten.lindahl@axis.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Introduce and use write_byte_data callbackMårten Lindahl2022-05-202-3/+23
| | | | | | | | | | | | | Some of the pmbus core functions uses pmbus_write_byte_data, which does not support driver callbacks for chip specific write operations. This could potentially influence some specific regulator chips that for example need a time delay before each data access. Lets add support for driver callback with _pmbus_write_byte_data. Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Link: https://lore.kernel.org/r/20220428144039.2464667-2-marten.lindahl@axis.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/max16601) Add MAX16602 supportAtif Ofluoglu2022-05-202-7/+10
| | | | | | | | Adding another MAX16602 chip support to MAX16601 driver Tested with MAX16602 works as expected. Signed-off-by: Atif Ofluoglu <atif.ofluoglu@maximintegrated.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) delta-ahe50dc-fan: work around hardware quirkZev Weiss2022-04-271-0/+16
| | | | | | | | | | | | CLEAR_FAULTS commands can apparently sometimes trigger catastrophic power output glitches on the ahe-50dc, so block them from being sent at all. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220427035109.3819-1-zev@bewilderbeest.net Fixes: d387d88ed045 ("hwmon: (pmbus) Add Delta AHE-50DC fan control module driver") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) disable PEC if not enabledAdam Wujek2022-04-251-0/+3
| | | | | | | | | | | | | | | | | | | | Explicitly disable PEC when the client does not support it. The problematic scenario is the following. A device with enabled PEC support is up and running and a kernel driver is loaded. Then the driver is unloaded (or device unbound), the HW device is reconfigured externally (e.g. by i2cset) to advertise itself as not supporting PEC. Without a new code, at the second load of the driver (or bind) the "flags" variable is not updated to avoid PEC usage. As a consequence the further communication with the device is done with the PEC enabled, which is wrong and may fail. The implementation first disable the I2C_CLIENT_PEC flag, then the old code enable it if needed. Fixes: 4e5418f787ec ("hwmon: (pmbus_core) Check adapter PEC support") Signed-off-by: Adam Wujek <dev_public@wujek.eu> Link: https://lore.kernel.org/r/20220420145059.431061-1-dev_public@wujek.eu Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (xdpe12284) Fix build warning seen if ↵Guenter Roeck2022-04-041-1/+1
| | | | | | | | | | | | | | | | | CONFIG_SENSORS_XDPE122_REGULATOR is disabled 0-day reports: drivers/hwmon/pmbus/xdpe12284.c:127:36: warning: unused variable 'xdpe122_reg_desc' This is seen if CONFIG_SENSORS_XDPE122_REGULATOR is not enabled. Mark xdpe122_reg_desc as __maybe_unused to fix the problem. Fixes: f53bfe4d6984 ("hwmon: (xdpe12284) Add regulator support") Reported-by: kernel test robot <lkp@intel.com> Cc: Marcello Sylvester Bauer <sylv@sylv.io> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add Vin unit off handlingBrandon Wyman2022-03-172-1/+2
| | | | | | | | | | | | | | | | | | | | | If there is an input undervoltage fault, reported in STATUS_INPUT command response, there is quite likely a "Unit Off For Insufficient Input Voltage" condition as well. Add a constant for bit 3 of STATUS_INPUT. Update the Vin limit attributes to include both bits in the mask for clearing faults. If an input undervoltage fault occurs, causing a unit off for insufficient input voltage, but the unit is off bit is not cleared, the STATUS_WORD will not be updated to clear the input fault condition. Including the unit is off bit (bit 3) allows for the input fault condition to completely clear. Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Link: https://lore.kernel.org/r/20220317232123.2103592-1-bjwyman@gmail.com Fixes: b4ce237b7f7d3 ("hwmon: (pmbus) Introduce infrastructure to detect sensors and limit registers") [groeck: Dropped unnecessary ()] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (adm1275) Allow setting sample averagingPotin Lai2022-03-021-1/+39
| | | | | | | | | | | | | | Current driver assume PWR_AVG and VI_AVG as 1 by default, and user needs to set sample averaging via sysfs manually. This patch parses the properties "adi,power-sample-average" and "adi,volt-curr-sample-average" from device tree, and setting sample averaging during probe. Input value must be one of value in the list [1, 2, 4, 8, 16, 32, 64, 128]. Signed-off-by: Potin Lai <potin.lai@quantatw.com> Link: https://lore.kernel.org/r/20220302123817.27025-2-potin.lai@quantatw.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (xdpe12284) Add regulator supportMarcello Sylvester Bauer2022-03-022-0/+17
| | | | | | | | | Add simple on/off regulator support for xdpe12284 and other pmbus parts supported by the xdpe12284 driver. Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io> Link: https://lore.kernel.org/r/f69b8e7fa32cd2bad9516d8fa590abb87c7e4869.1646214248.git.sylv@sylv.io Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (xdpe12284) Add support for xdpe11280Marcello Sylvester Bauer2022-03-021-3/+18
| | | | | | | | | | | Add support for another Infineon Multi-phase controller chip. The xdpe11280 uses linear instead of vid data format for VOUT. Detect VOUT_MODE format during identification and skip the xdpe122 related adaptions in case it is linear. Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io> Link: https://lore.kernel.org/r/fa6a4b636a05ecb337d132824efca2545188a2a2.1646214248.git.sylv@sylv.io Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/pli1209bc) Add regulator supportMarcello Sylvester Bauer2022-02-272-0/+38
| | | | | | | | Add regulator support for PLI1209BC Digital Supervisor. Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io> Link: https://lore.kernel.org/r/21b0cdb6dd72654effa451d3b1636ecd07b160e9.1645435888.git.sylv@sylv.io Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add support for pli1209bcMarcello Sylvester Bauer2022-02-273-0/+125
| | | | | | | | PLI1209BC is a Digital Supervisor from Vicor Corporation. Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io> Link: https://lore.kernel.org/r/4e016e66275bc46c90974aec18b150c874e64787.1645435888.git.sylv@sylv.io Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add regulator supply into macroMarcello Sylvester Bauer2022-02-271-0/+1
| | | | | | | | | | | | | | Add regulator supply into PWBUS_REGULATOR macro. This makes it optional to define a vin-supply in DT. Not defining a supply will add a dummy regulator supply instead and only cause the following debug output: ``` Looking up vin-supply property in node [...] failed ``` Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io> Link: https://lore.kernel.org/r/58f2ff7b90233fad3d7ae2e9d66d5192e2c1ac01.1645437439.git.sylv@sylv.io Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/lm25066) Add regulator supportZev Weiss2022-02-272-0/+21
| | | | | | | | | | | | While these chips aren't strictly advertised as voltage regulators per se, they (aside from the lm25056) support the PMBus OPERATION command to enable and disable their outputs and have status bits for reporting various warnings and faults, and can hence usefully support all the pmbus_regulator_ops operations. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> Link: https://lore.kernel.org/r/20220219000742.20126-1-zev@bewilderbeest.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add get_error_flags support to regulator opsZev Weiss2022-02-271-0/+114
| | | | | | | | | | | The various PMBus status bits don't all map perfectly to the more limited set of REGULATOR_ERROR_* flags, but there's a reasonable number where they correspond well enough. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> Link: https://lore.kernel.org/r/20220219000359.19985-1-zev@bewilderbeest.net [groeck: Added missing locking] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Remove trailing whitespaces from Kconfig fileMarcello Sylvester Bauer2022-02-271-2/+2
| | | | | | | | | Fix checkpatch issues by removing trailing whitespaces in Kconfig. Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io> Link: https://lore.kernel.org/r/c984b88b136a1cde16ce52c5f818886653b0f84a.1642434222.git.sylv@sylv.io [groeck: Updated subject] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add mutex to regulator opsPatrick Rudolph2022-02-271-3/+13
| | | | | | | | | | | | | | | | | On PMBUS devices with multiple pages, the regulator ops need to be protected with the update mutex. This prevents accidentally changing the page in a separate thread while operating on the PMBUS_OPERATION register. Tested on Infineon xdpe11280 while a separate thread polls for sensor data. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io> Link: https://lore.kernel.org/r/b991506bcbf665f7af185945f70bf9d5cf04637c.1645804976.git.sylv@sylv.io Fixes: ddbb4db4ced1b ("hwmon: (pmbus) Add regulator support") Cc: Alan Tull <atull@opensource.altera.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Clear pmbus fault/warning bits after readVikash Chandola2022-02-221-0/+5
| | | | | | | | | | | | Almost all fault/warning bits in pmbus status registers remain set even after fault/warning condition are removed. As per pmbus specification these faults must be cleared by user. Modify hwmon behavior to clear fault/warning bit after fetching data if fault/warning bit was set. This allows to get fresh data in next read. Signed-off-by: Vikash Chandola <vikash.chandola@linux.intel.com> Link: https://lore.kernel.org/r/20220222131253.2426834-1-vikash.chandola@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/ir38064) Mark ir38064_of_match as __maybe_unusedGuenter Roeck2022-01-231-1/+1
| | | | | | | | | | | | | If CONFIG_PM is not enabled, the following warning is reported. drivers/hwmon/pmbus/ir38064.c:54:34: warning: unused variable 'ir38064_of_match' Mark it as __maybe_unused. Reported-by: kernel test robot <lkp@intel.com> Cc: Arthur Heymans <arthur.heymans@9elements.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon/pmbus: (ir38064) Fix spelling mistake "comaptible" -> "compatible"Colin Ian King2021-12-261-1/+1
| | | | | | | | There is a spelling mistake in the module description, fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20211220155527.179125-1-colin.i.king@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon/pmbus: (ir38064) Expose a regulatorPatrick Rudolph2021-12-262-0/+17
| | | | | | | | | | The chip series supported by this driver are voltage regulators, so expose them to the regulator subsystem. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Link: https://lore.kernel.org/r/20211213142814.264802-4-arthur.heymans@9elements.com [groeck: Added brief patch description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon/pmbus: (ir38064) Add of_match_tableArthur Heymans2021-12-261-0/+12
| | | | | | | | Add the missing of_match_table to allow device tree probing. Signed-off-by: Arthur Heymans <arthur.heymans@9elements.com> Link: https://lore.kernel.org/r/20211213142814.264802-3-arthur.heymans@9elements.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon/pmbus: (ir38064) Add support for IR38060, IR38164 IR38263Patrick Rudolph2021-12-262-3/+6
| | | | | | | | | The IR38060, IR38164 and IR38263 can be supported using this driver. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Arthur Heymans <arthur.heymans@9elements.com> Link: https://lore.kernel.org/r/20211213142814.264802-2-arthur.heymans@9elements.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>