aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: (sht4x) do not overflow clamping operation on 32-bit platformsJason A. Donenfeld2022-09-251-1/+1
| | | | | | | | | | | On 32-bit platforms, long is 32 bits, so (long)UINT_MAX is less than (long)SHT4X_MIN_POLL_INTERVAL, which means the clamping operation is bogus. Fix this by clamping at INT_MAX, so that the upperbound is the same on all platforms. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Link: https://lore.kernel.org/r/20220924101151.4168414-1-Jason@zx2c4.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (sis5595) Reorder symbols to get rid of a few forward declarationsUwe Kleine-König2022-09-251-92/+84
| | | | | | | | | | | Declarations for static symbols are useless repetition unless there are cyclic dependencies. Reorder the functions and variables to get rid of 6 forward declarations. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220922074900.2763331-2-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (sis5595) Introduce a #define for the driver name and use itUwe Kleine-König2022-09-251-6/+7
| | | | | | | | | | | | Make use of the cpp symbol DRIVER_NAME to set the driver's name and use it instead of all explicit usages of the same string. Also make use of it instead of sis5595_driver.driver.name which breaks a cyclic dependency between sis5595_probe() and sis5595_driver that in the next commit allows to drop some forward declarations. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220922074900.2763331-1-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: Make use of devm_clk_get_enabled()Uwe Kleine-König2022-09-253-55/+3
| | | | | | | | | | | Several drivers manually register a devm handler to disable their clk. Convert them to devm_clk_get_enabled(). Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (mr75203) fix undefined reference to `__divdi3'Eliav Farber2022-09-251-2/+2
| | | | | | | | | | | Fix build error on 32-bit machines. Fixes: 94c025b6f735 ("hwmon: (mr75203) modify the temperature equation according to series 5 datasheet") Signed-off-by: Eliav Farber <farbere@amazon.com> Reported-by: kernel test robot <lkp@intel.com> Tested-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Link: https://lore.kernel.org/r/20220921121723.6726-1-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (vt8231) Reorder symbols to get rid of a few forward declarationsUwe Kleine-König2022-09-251-97/+91
| | | | | | | | | | | Declarations for static symbols are useless repetition unless there are cyclic dependencies. Reorder the functions and variables to get rid of 5 forward declarations. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220920135617.1046361-2-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (vt8231) Introduce a #define for the driver name and use itUwe Kleine-König2022-09-251-6/+8
| | | | | | | | | | | | Make use of the cpp symbol DRIVER_NAME to set the driver's name and use it instead of all explicit usages of the same string. Also make use of it instead of vt8231_driver.driver.name which breaks a cyclic dependency between vt8231_probe() and vt8231_driver that in the next commit allows to drop some forward declarations. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220920135617.1046361-1-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pc87360) Reorder symbols to get rid of a few forward declarationsUwe Kleine-König2022-09-251-720/+735
| | | | | | | | | | | Declarations for static symbols are useless repetition unless there are cyclic dependencies. Reorder the functions and variables to get rid of 6 forward declarations. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220919103155.795151-3-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pc87360) Introduce a #define for the driver name and use itUwe Kleine-König2022-09-251-3/+5
| | | | | | | | | | | | | | Make use of the cpp symbol DRIVER_NAME to set the driver's name and also as name for devm_request_region(). While at it add a module alias using the new define. This is a preparation for the next cleanup commit that removes a cyclic dependency between pc87360_driver (which references pc87360_probe in .probe) and pc87360_probe() (which used pc87360_driver.driver.name). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220919103155.795151-2-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pwm-fan) Switch regulator dynamicallyAlexander Stein2022-09-252-68/+154
| | | | | | | | | | | | | | | | | | This adds the enable attribute which is used to select if zero PWM duty means to switch off regulator and PWM or to keep them enabled but at inactive PWM output level. Depending on the select enable mode, turn off the regulator and PWM if the PWM duty is zero, or keep them enabled. This is especially important for fan using inverted PWM signal polarity. Having regulator supplied and PWM disabled, some PWM controllers provide the active, rather than inactive signal. With this change the shutdown as well as suspend/resume paths require modifcations as well. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Link: https://lore.kernel.org/r/20220914153137.613982-6-alexander.stein@ew.tq-group.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pwm-fan) split __set_pwm into locked/unlocked functionsAlexander Stein2022-09-251-8/+15
| | | | | | | | | | | | Regular calls to set_pwm don't hold the mutex, but the upcoming update_enable support needs to call set_pwm with the mutex being held. So provide the previous behavior in set_pwm (handling the lock), while adding __set_pwm which assumes the lock being held. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220914153137.613982-5-alexander.stein@ew.tq-group.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pwm-fan) Add dedicated power switch functionAlexander Stein2022-09-251-15/+31
| | | | | | | | | | This handles enabling/disabling the regulator in a single function, while keeping the enables/disabled balanced. This is a preparation when regulator is switched from different code paths. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Link: https://lore.kernel.org/r/20220914153137.613982-4-alexander.stein@ew.tq-group.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pwm-fan) Simplify enable/disable checkAlexander Stein2022-09-251-9/+34
| | | | | | | | | | Instead of comparing the current to the new pwm duty to decide whether to enable the PWM, use a dedicated flag. Also apply the new PWM duty in any case. This is a preparation to enable/disable the regulator dynamically. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Link: https://lore.kernel.org/r/20220914153137.613982-3-alexander.stein@ew.tq-group.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pwm-fan) Refactor fan power on/offAlexander Stein2022-09-251-6/+30
| | | | | | | | | | In preparation for dynamically switching regulator, split the power on and power off sequence into separate functions. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220914153137.613982-2-alexander.stein@ew.tq-group.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add driver for the TEXAS TPS546D24 Buck Converter.Duke Du2022-09-256-0/+124
| | | | | | | | | | | 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>
* MAINTAINERS: Add maintainer for hwmon/max31760Ibrahim Tilki2022-09-201-0/+9
| | | | | | | | Add maintainer for hwmon/max31760 driver Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com> Link: https://lore.kernel.org/r/20220910171945.48088-5-Ibrahim.Tilki@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* dt-bindings: hwmon: Add bindings for max31760Ibrahim Tilki2022-09-201-0/+42
| | | | | | | | | Adding bindings for Analog Devices MAX31760 Fan-Speed Controller Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20220910171945.48088-4-Ibrahim.Tilki@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* docs: hwmon: add max31760 documentationIbrahim Tilki2022-09-202-0/+78
| | | | | | | | Adding documentation for max31760 fan speed controller Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com> Link: https://lore.kernel.org/r/20220910171945.48088-3-Ibrahim.Tilki@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* drivers: hwmon: Add max31760 fan speed controller driverIbrahim Tilki2022-09-203-0/+609
| | | | | | | | | | | | MAX31760 is a precision fan speed controller with nonvolatile lookup table. Device has one internal and one external temperature sensor support. Controls two fans and measures their speeds. Generates hardware alerts when programmable max and critical temperatures are exceeded. Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com> Reviewed-by: Nurettin Bolucu <Nurettin.Bolucu@analog.com> Link: https://lore.kernel.org/r/20220910171945.48088-2-Ibrahim.Tilki@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (mr75203) fix coding style space errorsEliav Farber2022-09-191-20/+20
| | | | | | | | | | | Fix: "ERROR: space required before the open parenthesis '('" All of the errors were introduced before this series of patches. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220908152449.35457-22-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (mr75203) add debugfs to read and write temperature coefficientsEliav Farber2022-09-191-0/+62
| | | | | | | | | | | | | | | | | | | | This change adds debugfs to read and write temperature sensor coefficients - g, h, j and cal5. The coefficients can vary between product and product, so it can be very useful to be able to modify them on the fly during the calibration process. e.g.: cat /sys/kernel/debug/940f23d0000.pvt/ts_coeff_cal5 4096 echo 83000 > sys/kernel/debug/940f23d0000.pvt/ts_coeff_g Signed-off-by: Eliav Farber <farbere@amazon.com> Link: https://lore.kernel.org/r/20220908152449.35457-21-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (mr75203) parse temperature coefficients from device-treeEliav Farber2022-09-191-0/+9
| | | | | | | | | | | | | | Use thermal coefficients from the device tree if they exist. Otherwise, use default values according to the series (5 or 6). All coefficients can be used or only part of them. The coefficients shall be used for fine tuning the default values since coefficients can vary between product and product. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220908152449.35457-20-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* dt-bindings: hwmon: (mr75203) add coefficient properties for the thermal ↵Eliav Farber2022-09-191-0/+37
| | | | | | | | | | | | | | | | | | | | | equation Add optional temperature coefficient properties: *) moortec,ts-coeff-g *) moortec,ts-coeff-h *) moortec,ts-coeff-cal5 *) moortec,ts-coeff-j If defined they shall be used instead of defaults. The coefficients were added to device tree on top of the series property (which can be used to select between series 5 and series 6), because coefficients can vary between product and product, and code defaults might not be accurate enough. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220908152449.35457-19-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (mr75203) add support for series 6 temperature equationEliav Farber2022-09-191-4/+62
| | | | | | | | | | | | | | | | | | | | | | | | The current equation used in code is aligned to series 5: T = G + H * (n / cal5 - 0.5) + J * F Where: G = 60, H = 200, cal5 = 4094, J = -0.1, F = frequency clock in MHz Series 6 has a slightly different equation: T = G + H * (n / cal5 - 0.5) and a different set of coefficients: G = 57.4, H = 249.4, cal5 = 4096 This change supports equation and coefficients for both series. (for series 6, J is set to 0). The series is determined according to “moortec,ts-series” property in the device tree. If absent, series 5 is assumed to be the default. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220908152449.35457-18-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* dt-bindings: hwmon: (mr75203) add "moortec,ts-series" propertyEliav Farber2022-09-191-0/+9
| | | | | | | | | | | | | | | | | | | | Add optional "moortec,ts-series" property to define the temperature equation and coefficients that shall be used to convert the digital output to value in milli-Celsius. Supported series: 5 (default) and 6. Series 5: T = G + H * (n / cal5 - 0.5) + J * F Where: G = 60, H = 200, cal5 = 4094, J = -0.1, F = frequency clock in MHz Series 6: T = G + H * (n / cal5 - 0.5) Where: G = 57.4, H = 249.4, cal5 = 4096 Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220908152449.35457-17-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (aspeed-pwm-tacho) Add dependency on ARCH_ASPEEDPeter Robinson2022-09-191-0/+1
| | | | | | | | | The SENSORS_ASPEED is part of the Aspeed silicon so it makes sense to depend on ARCH_ASPEED and for compile testing. Signed-off-by: Peter Robinson <pbrobinson@gmail.com> Link: https://lore.kernel.org/r/20220916120936.372591-1-pbrobinson@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (mr75203) modify the temperature equation according to series 5 datasheetEliav Farber2022-09-191-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | Modify the equation and coefficients used to convert the digital output to temperature according to series 5 of the Moortec Embedded Temperature Sensor (METS) datasheet: T = G + H * (n / cal5 - 0.5) + J * F Where: *) G = 60, H = 200, cal5 = 4094, J = -0.1. *) F = frequency clock in MHz. *) n is the digital output. In code, the G, H and J coefficients are multiplied by a factor of 1000 to get the temperature in milli-Celsius. Final result is clamped in case it exceeds min/max thresholds. Change is done since it is unclear where the current equation and coefficients came from. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220908152449.35457-16-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (mr75203) add VM pre-scaler x2 supportEliav Farber2022-09-191-2/+53
| | | | | | | | | | | | | | | | | | | | Add support for mr76006 pre-scaler which provides divide-by-2 scaling of the input voltage, so that it can be presented to the VM for measurement within its range (the VM input range is limited from -0.1V to 1V). The driver reads from the device-tree all the channels that use the mr76006 pre-scaler and multiplies the voltage result by a factor of 2, to represent to the user with the actual voltage input source. Channels that are not in the device-tree are multiplied by a factor of 1. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220908152449.35457-15-farbere@amazon.com [groeck: Addressed conflicts against commit d59eacaac953] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* dt-bindings: hwmon: (mr75203) add "moortec,vm-pre-scaler-x2" propertyEliav Farber2022-09-191-0/+13
| | | | | | | | | | | | | | | | | Add support for mr76006 pre-scaler which provides divide-by-2 scaling of the input voltage, so that it can be presented to the VM for measurement within its range (the VM input range is limited to -0.1V to 1V). The new "moortec,vm-pre-scaler-x2" property lists the channels that use the mr76006 pre-scaler. The driver will use this list to multiply the voltage result by 2, to present to the user with the actual voltage input source. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220908152449.35457-14-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (mr75203) add VM active channel supportEliav Farber2022-09-191-22/+99
| | | | | | | | | | | | | | | | | Add active channel support per voltage monitor. The number of active channels is read from the device-tree. When absent in device-tree, all channels are assumed to be used. This shall be useful to expose sysfs only for inputs that are connected to a voltage source. Setting number of active channels to 0, means that entire VM sensor is not used. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220908152449.35457-13-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* dt-bindings: hwmon: (mr75203) add "moortec,vm-active-channels" propertyEliav Farber2022-09-191-0/+10
| | | | | | | | | | | | | Add optional "moortec,vm-active-channels" property to define the number of active channels per VM. This shall be useful to avoid exposing sysfs for reading inputs that are not connected to any voltage source. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220908152449.35457-12-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* dt-bindings: vendor-prefixes: add vendor prefix for MoortecEliav Farber2022-09-191-0/+2
| | | | | | | | | | | | | Add device-tree vendor prefix for Moortec Semiconductor Ltd. Website: https://moortec.com/ Moortec were acquired by Synopsys so link above leads to: https://www.synopsys.com/solutions/silicon-lifecycle-management.html Signed-off-by: Eliav Farber <farbere@amazon.com> Acked-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220908152449.35457-11-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nzxt-smart2) add another USB IDAleksandr Mezin2022-09-191-0/+1
| | | | | | | | No known differences from already supported devices. Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com> Link: https://lore.kernel.org/r/20220918115506.61870-1-mezin.alexander@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (emc2305) Remove unnecessary range checkGuenter Roeck2022-09-191-2/+0
| | | | | | | | | | | | | | | | Static analyzers report: drivers/hwmon/emc2305.c:194 emc2305_set_cur_state() warn: impossible condition '(val > 255) => (0-255 > 255)' 'val' is u8 and thus can never be larger than 255. In theory the operation calculating 'val' could result in a value larger than 255, but this won't happen because its parameter has already been range checked and it is guaranteed that the result never exceeds 255. Remove the unnecessary value check. Cc: Michael Shych <michaelsh@nvidia.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (mr75203) skip reset-control deassert for SOCs that don't support itEliav Farber2022-09-191-4/+7
| | | | | | | | | | | | Don't fail the probe function and don't deassert the reset controller if a "reset" property doesn't exist in the device tree. Change is done for SOCs that don't support a reset controller. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220908152449.35457-10-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* dt-bindings: hwmon: (mr75203) change "resets" property to be optionalEliav Farber2022-09-191-1/+0
| | | | | | | | | | Change "resets" property to be optional instead of required, for SOCs that don't support a reset controller. Signed-off-by: Eliav Farber <farbere@amazon.com> Acked-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220908152449.35457-9-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* dt-bindings: hwmon: (mr75203) add description for Moortec's PVT controllerEliav Farber2022-09-191-0/+26
| | | | | | | | | | This changes adds a detailed description for the mr75203 controller and for some of the analog IPs controlled by it. Signed-off-by: Eliav Farber <farbere@amazon.com> Acked-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220908152449.35457-8-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow NextAleksa Savic2022-09-193-6/+96
| | | | | | | | | | | | | | | | | | | | | | | Extend aquacomputer_d5next driver to expose various hardware sensors of the Aquacomputer High Flow Next flow sensor, which communicates through a proprietary USB HID protocol. The High Flow Next exposes +5V voltages, water quality, conductivity and flow readings. A temperature sensor can be connected to it, in which case it provides its reading and an estimation of the dissipated/absorbed power in the liquid cooling loop. Additionally, serial number and firmware version are exposed through debugfs. Registry offsets were discovered and tested by users on Github [1] [2]. [1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/issues/8 [2] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/34 Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com> Link: https://lore.kernel.org/r/20220907100739.806571-1-savicaleksa83@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (tps23861) create unique debugfs directory per deviceAlexandru Gagniuc2022-09-191-3/+11
| | | | | | | | | | | | | | | | On systems with more than one tps23861, creating the debugfs directory for additional devices fails with debugfs: Directory 'tps23861' with parent '/' already present! To resolve this, include the hwmon device name in the directory name. Since the name is unique, this guarantees that the debugfs directory is unique. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220907015405.16547-2-mr.nuke.me@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (tps23861) reduce count of i2c transactions for port_statusAlexandru Gagniuc2022-09-191-55/+24
| | | | | | | | | | | | | When reading the 'port_status' debugfs entry, some I2C registers were read more than once. This looks inefficient in an I2C trace. To reduce I2C traffic, update tps23861_port_status_show() to only read each register once. Indexing the port number from 0 instead of 1 also allows simplifying things a bit. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Link: https://lore.kernel.org/r/20220907015405.16547-1-mr.nuke.me@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (emc2305) Remove unused including <linux/version.h>Jiapeng Chong2022-09-191-1/+0
| | | | | | | | | | ./drivers/hwmon/emc2305.c: 14 linux/version.h not needed. Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2024 Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Link: https://lore.kernel.org/r/20220901022332.40248-1-jiapeng.chong@linux.alibaba.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* docs: hwmon: add emc2305.rst to docsMichael Shych2022-09-192-0/+38
| | | | | | | | | | Add description of emc2305 driver. Signed-off-by: Michael Shych <michaelsh@nvidia.com> Reviewed-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20220810171552.56417-4-michaelsh@nvidia.com [groeck: Fixed htmldocs warnings] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (emc2305) add support for EMC2301/2/3/5 RPM-based PWM Fan Speed ↵Michael Shych2022-09-193-0/+638
| | | | | | | | | | | | | | Controller. Add driver for Microchip EMC2301/2/3/5 RPM-based PWM Fan Speed Controller. Modify Makefile and Kconfig to support Microchip EMC2305 RPM-based PWM Fan Speed Controller. Signed-off-by: Michael Shych <michaelsh@nvidia.com> Reviewed-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20220810171552.56417-3-michaelsh@nvidia.com [groeck: Drop unnecessary () around DIV_ROUND_CLOSEST()] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* platform_data/emc2305: define platform data for EMC2305 driverMichael Shych2022-09-191-0/+22
| | | | | | | | | | | | Introduce platform data structure for EM2305 driver to allow configuration device PWMs and thermal zones by passing required platform data to the driver. If no platform data is provided, the driver is supposed to work with default settings. Signed-off-by: Michael Shych <michaelsh@nvidia.com> Reviewed-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20220810171552.56417-2-michaelsh@nvidia.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (max31790) add fanN_enableJustin Ledford2022-09-192-7/+32
| | | | | | | | | | | | | | The MAX31790 has a tach input enable bit in each fan's configuration register. This is only enabled by the driver if RPM mode is selected, but the driver doesn't provide a way to independently enable tachometer input regardless of the regulator mode. By adding the fanN_enable sysfs files, we can decouple the tach input from the regulator mode. Also update the documentation. Signed-off-by: Justin Ledford <justinledford@google.com> Link: https://lore.kernel.org/r/20220829195930.2521755-1-justinledford@google.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* pwm: core: Make of_pwm_get() staticAndy Shevchenko2022-09-192-13/+2
| | | | | | | | | | There are no users outside of PWM core of the of_pwm_get(). Make it static. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220826172642.16404-3-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* pwm: core: Get rid of unused devm_of_pwm_get()Andy Shevchenko2022-09-194-43/+1
| | | | | | | | | | | | | The devm_of_pwm_get() has recently lost its single user, drop the dead API as well. Note, the new code should use either plain pwm_get() or managed devm_pwm_get() or devm_fwnode_pwm_get() APIs. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220826172642.16404-2-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pwm-fan) Replace OF specific call to PWM by plain oneAndy Shevchenko2022-09-191-1/+1
| | | | | | | | | | | | | There is no need to call OF specific devm_of_pwm_get() since the device node parameter duplicates in the device parameter. Hence we may safely replace it by plain devm_pwm_get() call. This allows to drop devm_of_pwm_get() as no more users will be. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220826172642.16404-1-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (sparx5) Use devm_clk_get_enabled() helperChristophe JAILLET2022-09-191-18/+1
| | | | | | | | | | | | | | | | | | | | The devm_clk_get_enabled() helper: - calls devm_clk_get() - calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code, the error handling paths and avoid the need of a dedicated function used with devm_add_action_or_reset(). Based on my test with allyesconfig, this reduces the .o size from: text data bss dec hex filename 2419 1472 0 3891 f33 drivers/hwmon/sparx5-temp.o down to: 2155 1472 0 3627 e2b drivers/hwmon/sparx5-temp.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/cfe4c965074b5ecbe03830b05e038b4594c7b970.1661336689.git.christophe.jaillet@wanadoo.fr Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (dell-smm) Improve warning messagesArmin Wolf2022-09-191-4/+10
| | | | | | | | | | | | | | | | | | | When dell-smm-hwmon is loaded on a machine with a buggy BIOS with the option "force" being enabled, it wrongly prints that the buggy features where disabled. This may cause users to wrongly assume that the driver still protects them from these BIOS bugs even with "force" being enabled. Replace the messages with two messages each which are depending on the value of the "force" parameter. The messages which are being printed when "force" is not set use dev_notice() instead of dev_warn() since they only serve as a notice. Tested on a Dell Inspiron 3505. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20220822174053.8750-3-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>