Commit Graph

1123039 Commits

Author SHA1 Message Date
Uwe Kleine-König ac387b0cb3 hwmon: (vt8231) Reorder symbols to get rid of a few forward declarations
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>
2022-09-25 14:22:11 -07:00
Uwe Kleine-König 6c7c469c80 hwmon: (vt8231) Introduce a #define for the driver name and use it
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>
2022-09-25 14:22:11 -07:00
Uwe Kleine-König 070affa898 hwmon: (pc87360) Reorder symbols to get rid of a few forward declarations
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>
2022-09-25 14:22:11 -07:00
Uwe Kleine-König 02e0500553 hwmon: (pc87360) Introduce a #define for the driver name and use it
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>
2022-09-25 14:22:11 -07:00
Alexander Stein b99152d4f0 hwmon: (pwm-fan) Switch regulator dynamically
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>
2022-09-25 14:22:11 -07:00
Alexander Stein 9db6e7f500 hwmon: (pwm-fan) split __set_pwm into locked/unlocked functions
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>
2022-09-25 14:22:11 -07:00
Alexander Stein 9bf3aa6080 hwmon: (pwm-fan) Add dedicated power switch function
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>
2022-09-25 14:22:10 -07:00
Alexander Stein b77f0c7680 hwmon: (pwm-fan) Simplify enable/disable check
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>
2022-09-25 14:22:10 -07:00
Alexander Stein bf10ccad06 hwmon: (pwm-fan) Refactor fan power on/off
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>
2022-09-25 14:22:10 -07:00
Duke Du cc842bd57e hwmon: (pmbus) Add driver for the TEXAS TPS546D24 Buck Converter.
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>
2022-09-25 14:21:52 -07:00
Ibrahim Tilki 5768adcb35 MAINTAINERS: Add maintainer for hwmon/max31760
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>
2022-09-20 07:12:24 -07:00
Ibrahim Tilki 479d14cfe5 dt-bindings: hwmon: Add bindings for max31760
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>
2022-09-20 07:12:01 -07:00
Ibrahim Tilki 8e27c2fd61 docs: hwmon: add max31760 documentation
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>
2022-09-20 07:11:32 -07:00
Ibrahim Tilki 38b04ad02d drivers: hwmon: Add max31760 fan speed controller driver
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>
2022-09-20 07:10:58 -07:00
Eliav Farber 0cb15e8ae0 hwmon: (mr75203) fix coding style space errors
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>
2022-09-19 06:22:42 -07:00
Eliav Farber a4dd0b80b4 hwmon: (mr75203) add debugfs to read and write temperature coefficients
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>
2022-09-19 06:21:53 -07:00
Eliav Farber 27937d6f8e hwmon: (mr75203) parse temperature coefficients from device-tree
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>
2022-09-19 06:21:04 -07:00
Eliav Farber bf1fdafdbc dt-bindings: hwmon: (mr75203) add coefficient properties for the thermal 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>
2022-09-19 06:19:33 -07:00
Eliav Farber 3b12ca798e hwmon: (mr75203) add support for series 6 temperature equation
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>
2022-09-19 06:18:44 -07:00
Eliav Farber 34339c858c dt-bindings: hwmon: (mr75203) add "moortec,ts-series" property
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>
2022-09-19 06:17:48 -07:00
Peter Robinson 331ed050c1 hwmon: (aspeed-pwm-tacho) Add dependency on ARCH_ASPEED
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>
2022-09-19 06:17:07 -07:00
Eliav Farber 94c025b6f7 hwmon: (mr75203) modify the temperature equation according to series 5 datasheet
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>
2022-09-19 06:17:06 -07:00
Eliav Farber 430c0d7ff5 hwmon: (mr75203) add VM pre-scaler x2 support
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 d59eacaac9]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-09-19 06:17:06 -07:00
Eliav Farber 64a2486c39 dt-bindings: hwmon: (mr75203) add "moortec,vm-pre-scaler-x2" property
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>
2022-09-19 06:17:06 -07:00
Eliav Farber b7f5ac92fe hwmon: (mr75203) add VM active channel support
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>
2022-09-19 06:17:06 -07:00
Eliav Farber 09288b8fe1 dt-bindings: hwmon: (mr75203) add "moortec,vm-active-channels" property
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>
2022-09-19 06:17:06 -07:00
Eliav Farber 0ecba6ae80 dt-bindings: vendor-prefixes: add vendor prefix for Moortec
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>
2022-09-19 06:17:06 -07:00
Aleksandr Mezin 887b22ec07 hwmon: (nzxt-smart2) add another USB ID
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>
2022-09-19 06:17:06 -07:00
Guenter Roeck a31d53598c hwmon: (emc2305) Remove unnecessary range check
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>
2022-09-19 06:17:06 -07:00
Eliav Farber 493372f5d3 hwmon: (mr75203) skip reset-control deassert for SOCs that don't support it
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>
2022-09-19 06:17:06 -07:00
Eliav Farber 5b5e91652e dt-bindings: hwmon: (mr75203) change "resets" property to be optional
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>
2022-09-19 06:17:06 -07:00
Eliav Farber a658b4d389 dt-bindings: hwmon: (mr75203) add description for Moortec's PVT controller
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>
2022-09-19 06:17:06 -07:00
Aleksa Savic aed80bb91d hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow Next
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>
2022-09-19 06:17:06 -07:00
Alexandru Gagniuc 856361b397 hwmon: (tps23861) create unique debugfs directory per device
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>
2022-09-19 06:17:06 -07:00
Alexandru Gagniuc 0fed840c75 hwmon: (tps23861) reduce count of i2c transactions for port_status
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>
2022-09-19 06:17:06 -07:00
Jiapeng Chong 4444a06981 hwmon: (emc2305) Remove unused including <linux/version.h>
./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>
2022-09-19 06:17:06 -07:00
Michael Shych 005cc9b4f1 docs: hwmon: add emc2305.rst to docs
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>
2022-09-19 06:17:06 -07:00
Michael Shych 0d8400c5a2 hwmon: (emc2305) add support for EMC2301/2/3/5 RPM-based PWM Fan Speed 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>
2022-09-19 06:17:06 -07:00
Michael Shych 41929b72eb platform_data/emc2305: define platform data for EMC2305 driver
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>
2022-09-19 06:17:05 -07:00
Justin Ledford 5b38279e1a hwmon: (max31790) add fanN_enable
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>
2022-09-19 06:17:05 -07:00
Andy Shevchenko b5ae0ad564 pwm: core: Make of_pwm_get() static
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>
2022-09-19 06:17:05 -07:00
Andy Shevchenko b88c48bfdd pwm: core: Get rid of unused devm_of_pwm_get()
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>
2022-09-19 06:17:05 -07:00
Andy Shevchenko 2e2aa25cf5 hwmon: (pwm-fan) Replace OF specific call to PWM by plain one
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>
2022-09-19 06:17:05 -07:00
Christophe JAILLET 907f2e4f17 hwmon: (sparx5) Use devm_clk_get_enabled() helper
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>
2022-09-19 06:17:05 -07:00
Armin Wolf 6ebab74e09 hwmon: (dell-smm) Improve warning messages
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>
2022-09-19 06:17:05 -07:00
Andy Shevchenko b7b568c252 hwmon: (iio_hwmon) Make use of device properties
Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Include mod_devicetable.h explicitly to replace the dropped of.h
which included mod_devicetable.h indirectly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220826173700.17395-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-09-19 06:17:05 -07:00
Juerg Haefliger 9be5223afc MAINTAINERS: Update Juerg Haefliger's email address
Use my main @proton.me email address.

Signed-off-by: Juerg Haefliger <juergh@proton.me>
Link: https://lore.kernel.org/r/20220819055039.840221-1-juergh@proton.me
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-09-19 06:17:05 -07:00
Wolfram Sang f2f394db4b hwmon: move from strlcpy with unused retval to strscpy
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20220818210014.6769-1-wsa+renesas@sang-engineering.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-09-19 06:17:05 -07:00
Wilken Gottwalt eb12f54876 hwmon: (corsair-psu) add reporting of rail mode via debugfs
Add reporting if the PSU is running in single or multi rail mode via
ocpmode debugfs entry. Also update the documentation and driver comments
accordingly.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/YvS9PZKr0xqFqJny@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-09-19 06:17:05 -07:00
Aleksa Savic e2769f5e7f hwmon: (aquacomputer_d5next) Add support for reading virtual temp sensors
Add support for reading virtual temperature sensors for the D5 Next, Octo,
Quadro and Farbwerk 360.

Virtual temperature sensors are written to the device by the user, pulling
from an arbitrary value source. Writing to them is not yet reverse
engineered, so the only way to set them for now is to use the official
software.

Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20220817121441.112198-1-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-09-19 06:17:05 -07:00