summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | hwmon: (asus-ec-sensors) Add Crosshair VIII Hero WiFiEugene Shalygin2022-02-271-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Wi-Fi variant of Crosshair VIII Hero provides the same sensors, which was tested by a Libre Hardware Monitor user [1]. [1] https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/pull/453#issuecomment-1028398487 Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com> Link: https://lore.kernel.org/r/20220203203052.441712-1-eugene.shalygin@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (max6639) Add regulator supportMarcello Sylvester Bauer2022-02-271-8/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add regulator support for boards where the fan-supply have to be powered up before it can be used. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io> Link: https://lore.kernel.org/r/2cb9ed600fb43cdc604799746fbde2e2942cdca6.1643299570.git.sylv@sylv.io Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (mlxreg-fan) Use pwm attribute for setting fan speed low limitVadim Pasternak2022-02-271-57/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recently 'cur_state' user space 'sysfs' interface 'sysfs' has been deprecated. This interface is used in Nvidia systems for setting fan speed limit. Currently fan speed limit is set from the user space by setting 'sysfs' 'cur_state' attribute to 'max_state + n', where 'n' is required limit, for example: 15 for 50% speed limit, 20 for full fan speed enforcement. The purpose of this feature is to provides ability to limit fan speed according to some system wise considerations, like absence of some replaceable units (PSU or line cards), high system ambient temperature, unreliable transceivers temperature sensing or some other factors which indirectly impacts system's airflow. The motivation is to support fan low limit feature through 'hwmon' interface. Use 'hwmon' 'pwm' attribute for setting low limit for fan speed in case 'thermal' subsystem is configured in kernel. In this case setting fan speed through 'hwmon' will never let the 'thermal' subsystem to select a lower duty cycle than the duty cycle selected with the 'pwm' attribute. From other side, fan speed is to be updated in hardware through 'pwm' only in case the requested fan speed is above last speed set by 'thermal' subsystem, otherwise requested fan speed will be just stored with no PWM update. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20220126141825.13545-1-vadimp@nvidia.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: deprecate asis_wmi_ec_sensors driverEugene Shalygin2022-02-271-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecate the asus_wmi_ec_sensors driver in favor of the asus_ec_sensors Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com> Reviewed-by: Oleksandr Natalenko <oleksandr@natalenko.name> Link: https://lore.kernel.org/r/20220124015658.687309-4-eugene.shalygin@gmail.com Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> Tested-by: Denis Pauk <pauk.denis@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (asus-ec-sensors) add driver for ASUS ECEugene Shalygin2022-02-273-0/+706
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver provides the same data as the asus_wmi_ec_sensors driver (and gets it from the same source) but does not use WMI, polling the ACPI EC directly. That provides two enhancements: sensor reading became quicker (on some systems or kernel configuration it took almost a full second to read all the sensors, that transfers less than 15 bytes of data), the driver became more flexible. The driver now relies on ACPI mutex to lock access to the EC in the same way as the WMI code does. Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com> Link: https://lore.kernel.org/r/20220124015658.687309-2-eugene.shalygin@gmail.com Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> Tested-by: Denis Pauk <pauk.denis@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (sch56xx-common) Replace WDOG_ACTIVE with WDOG_HW_RUNNINGArmin Wolf2022-02-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the watchdog was already enabled by the BIOS after booting, the watchdog infrastructure needs to regularly send keepalives to prevent a unexpected reset. WDOG_ACTIVE only serves as an status indicator for userspace, we want to use WDOG_HW_RUNNING instead. Since my Fujitsu Esprimo P720 does not support the watchdog, this change is compile-tested only. Suggested-by: Guenter Roeck <linux@roeck-us.net> Fixes: fb551405c0f8 (watchdog: sch56xx: Use watchdog core) Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20220131211935.3656-5-W_Armin@gmx.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (sch56xx-common) Replace msleep() with usleep_range()Armin Wolf2022-02-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | msleep(1) will often sleep more than 20ms, slowing down sensor and watchdog reads/writes. Use usleep_range() as recommended in timers-howto.rst to fix that. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20220131211935.3656-4-W_Armin@gmx.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (sch56xx-common) Add automatic module loading on supported devicesArmin Wolf2022-02-271-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables the sch56xx-common module to get automatically loaded on supported machines. If a machine supports Fujitsu's SCH56XX-based hardware monitoring solutions, it contains a "Antiope"/" Antiope" dmi onboard device in case of the sch5627 or a "Theseus"/" Theseus" dmi onboard device in case of the sch5636. Since some machines like the Esprimo C700 have a seemingly faulty DMI table containing both onboard devices, the driver still needs to probe for the individual superio chip, which in presence of at least one DMI onboard device however can be considered safe. Also add a module parameter allowing for bypassing the DMI check. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20220131211935.3656-3-W_Armin@gmx.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (sch56xx) Autoload modules on platform device creationArmin Wolf2022-02-272-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now, when sch56xx-common has detected a SCH5627/SCH5636 superio chip, the corresponding module is not automatically loaded. Fix that by adding the necessary device tables to both modules. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20220131211935.3656-2-W_Armin@gmx.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: Fix possible NULL pointerPaul Cercueil2022-02-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recent addition of the label attribute added some code that read the "label" device property, without checking first that "dev" was non-NULL. Fix this issue by first checking that "dev" is non-NULL. Fixes: ccd98cba6a18 ("hwmon: Add "label" attribute") Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (powr1220) Add support for Lattice's POWR1014 power manager ICMichael Shych2022-02-271-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for Lattice's POWR1014 power manager IC. Read access to all the ADCs on the chip are supported through the "hwmon" "sysfs" files. The main differences of POWR1014 compared to POWR1220 are amount of VMON input lines: 10 on POWR1014 and 12 lines on POWR1220 and number of output control signals: 14 on POWR1014 and 20 on POWR1220. Signed-off-by: Michael Shych <michaelsh@nvidia.com> Reviewed-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20220118075611.10665-4-michaelsh@nvidia.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (powr1220) Upgrade driver to support hwmon info infrastructureMichael Shych2022-02-271-115/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce code by using devm_hwmon_device_register_with_groups() API by devm_hwmon_device_register_with_info() API. The motivation is to reduce code and to allow easy support for similar devices by the same driver. Signed-off-by: Michael Shych <michaelsh@nvidia.com> Reviewed-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20220118075611.10665-3-michaelsh@nvidia.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (powr1220) Cosmetic changesMichael Shych2022-02-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update code alignments. Signed-off-by: Michael Shych <michaelsh@nvidia.com> Link: https://lore.kernel.org/r/20220118075611.10665-2-michaelsh@nvidia.com 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: (asus_wmi_sensors) add ASUS ROG STRIX B450-F GAMING IIDenis Pauk2022-02-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ASUS ROG STRIX B450-F GAMING II has support of the same WMI monitoring method as ASUS ROG STRIX B450-F GAMING. This commit adds "ASUS ROG STRIX B450-F GAMING II" to the list of boards that can be monitored using ASUS WMI. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Tested-by: Aleksa Savic <savicaleksa83@gmail.com> Link: https://lore.kernel.org/r/20220112214917.11662-1-pauk.denis@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (asus_wmi_ec_sensors) Support T_Sensor on Prime X570-ProAnthony DeRossi2022-02-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Asus Prime X570-Pro motherboards have a T_Sensor header that can be connected to an optional temperature probe. Signed-off-by: Anthony DeRossi <ajderossi@gmail.com> Link: https://lore.kernel.org/r/20220111051842.25634-1-ajderossi@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (nct6775) add PRIME B550-PLUS motherboard to whitelistDmitry Baryshkov2022-02-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Asus PRIME B550-PLUS motherboards have got an nct6775 chip. Its resource range is covered by the \AMW0.SHWM OpRegion, so the chip is unusable when using SIO. However ASUS WMI access works. Add PRIME B550-PLUS to the list of motherboards using ASUS WMI to read data. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20220110024712.753492-1-dmitry.baryshkov@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (nct6775) add ASUS Pro B550M-C/PRIME B550M-ADenis Pauk2022-02-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ASUS Pro B550M-C/PRIME B550M-A boards have got an nct6775 chip, but by default there's no use of it because of resource conflict with WMI method. This commit adds "Pro B550M-C" and "PRIME B550M-A" to the list of boards that can be monitored using ASUS WMI. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Tested-by: Gregory P. Smith <greg@krypto.org> Tested-by: Joel Wirāmu <jwp@redhat.com> Tested-by: Jonathan Farrugia <jonfarr87@gmail.com> Link: https://lore.kernel.org/r/20220112215013.11694-1-pauk.denis@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: Add "label" attributePaul Cercueil2022-02-271-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a label is defined in the device tree for this device add that to the device specific attributes. This is useful for userspace to be able to identify an individual device when multiple identical chips are present in the system. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Tested-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Link: https://lore.kernel.org/r/20220110182256.30763-3-paul@crapouillou.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (nct6775) add support for TSI temperature registersZev Weiss2022-02-271-6/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These registers report CPU temperatures (and, depending on the system, sometimes chipset temperatures) via the TSI interface on AMD systems. They're distinct from most of the other Super-IO temperature readings (CPUTIN, SYSTIN, etc.) in that they're not a selectable source for monitoring and are in a different (higher resolution) format, but can still provide useful temperature data. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> Tested-by: Renze Nicolai <renze@rnplus.nl> Link: https://lore.kernel.org/r/20220113164629.21924-1-zev@bewilderbeest.net Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (lm83) Convert to use with_info APIGuenter Roeck2022-02-271-132/+183
| | | | | | | | | | | | | | | | | | | | | | | | Use with_info API to reduce code size and simplify the code. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (lm83) Explain why LM82 may be misdetected as LM83Guenter Roeck2022-02-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the March 2013 revision of the LM82 datasheet, the latest LM82 die revision is 0x03. This was confirmed and observed with a real chip. Further details in this revision of the LM82 datasheet suggest that LM82 is now just a repackaged LM83. Such versions of LM82 will be detected as LM83. Add comment to the code explaining why this may happen. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (lm83) Demote log message if chip identification failsGuenter Roeck2022-02-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There should be no message in the kernel function if the detect function fails to identify a chip; this is perfectly normal and does not warrant a kernel log entry. Demote message to debug. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (lm83) Replace temperature conversion macros with standard functionsGuenter Roeck2022-02-271-13/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace TEMP_FROM_REG with direct calculation and TEMP_TO_REG with standard functions/macros. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (lm83) Use regmapGuenter Roeck2022-02-272-65/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using local caching in this driver had few benefits. It used cached values for two seconds and then re-read all registers from the chip even if the user only accessed a single attribute. On top of that, alarm attributes were stale for up to four seconds (the first status register read reports and clears an alarm, the second reports it cleared). Use regmap instead for caching. Do not re-read non-volatile registers, and do not cache volatile registers. As part of this change, handle register read and write address differences in regmap code. This is necessary to avoid problems with caching in the regmap core, and ultimately simplifies the code. Also, errors observed when reading from and writing to registers are no longer ignored. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (lm83) Replace new_client with clientGuenter Roeck2022-02-271-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has no value to name a variable 'new_client' in probe and detect functions; it is obvious that the client is new. Use 'client' as variable name instead. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (lm83) Move lm83_id to avoid forward declarationGuenter Roeck2022-02-271-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to keep lm83_id at the end of the driver. Move it forward to where it is needed to avoid a forward declaration. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: (lm83) Reorder include files to be in alphabetic orderGuenter Roeck2022-02-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Reorder include files to be in alphabetic order to simplify driver maintenance. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | | hwmon: Report attribute name with udev eventsGuenter Roeck2022-02-271-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up to now udev events only report the affected hwmon device if an alert is reported. This requires userspace to read all attributes if it wants to know what triggered the event. Provide the attribute name with the NAME property to help userspace find the attribute causing the event. 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: Handle failure to register sensor with thermal zone correctlyGuenter Roeck2022-02-221-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an attempt is made to a sensor with a thermal zone and it fails, the call to devm_thermal_zone_of_sensor_register() may return -ENODEV. This may result in crashes similar to the following. Unable to handle kernel NULL pointer dereference at virtual address 00000000000003cd ... Internal error: Oops: 96000021 [#1] PREEMPT SMP ... pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : mutex_lock+0x18/0x60 lr : thermal_zone_device_update+0x40/0x2e0 sp : ffff800014c4fc60 x29: ffff800014c4fc60 x28: ffff365ee3f6e000 x27: ffffdde218426790 x26: ffff365ee3f6e000 x25: 0000000000000000 x24: ffff365ee3f6e000 x23: ffffdde218426870 x22: ffff365ee3f6e000 x21: 00000000000003cd x20: ffff365ee8bf3308 x19: ffffffffffffffed x18: 0000000000000000 x17: ffffdde21842689c x16: ffffdde1cb7a0b7c x15: 0000000000000040 x14: ffffdde21a4889a0 x13: 0000000000000228 x12: 0000000000000000 x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 x8 : 0000000001120000 x7 : 0000000000000001 x6 : 0000000000000000 x5 : 0068000878e20f07 x4 : 0000000000000000 x3 : 00000000000003cd x2 : ffff365ee3f6e000 x1 : 0000000000000000 x0 : 00000000000003cd Call trace: mutex_lock+0x18/0x60 hwmon_notify_event+0xfc/0x110 0xffffdde1cb7a0a90 0xffffdde1cb7a0b7c irq_thread_fn+0x2c/0xa0 irq_thread+0x134/0x240 kthread+0x178/0x190 ret_from_fork+0x10/0x20 Code: d503201f d503201f d2800001 aa0103e4 (c8e47c02) Jon Hunter reports that the exact call sequence is: hwmon_notify_event() --> hwmon_thermal_notify() --> thermal_zone_device_update() --> update_temperature() --> mutex_lock() The hwmon core needs to handle all errors returned from calls to devm_thermal_zone_of_sensor_register(). If the call fails with -ENODEV, report that the sensor was not attached to a thermal zone but continue to register the hwmon device. Reported-by: Jon Hunter <jonathanh@nvidia.com> Cc: Dmitry Osipenko <digetx@gmail.com> Fixes: 1597b374af222 ("hwmon: Add notification support") Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | hwmon: (ntc_thermistor) Underscore Samsung thermistorLinus Walleij2022-02-191-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sysfs does not like that we name the thermistor something that contains a dash: ntc-thermistor thermistor: hwmon: 'ssg1404-001221' is not a valid name attribute, please fix Fix it up by switching to an underscore. Fixes: e13e979b2b3d ("hwmon: (ntc_thermistor) Add Samsung 1404-001221 NTC") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20220205005804.123245-1-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (nct6775) Fix crash in clear_caseopenGuenter Roeck2022-01-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Paweł Marciniak reports the following crash, observed when clearing the chassis intrusion alarm. BUG: kernel NULL pointer dereference, address: 0000000000000028 PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 3 PID: 4815 Comm: bash Tainted: G S 5.16.2-200.fc35.x86_64 #1 Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./Z97 Extreme4, BIOS P2.60A 05/03/2018 RIP: 0010:clear_caseopen+0x5a/0x120 [nct6775] Code: 68 70 e8 e9 32 b1 e3 85 c0 0f 85 d2 00 00 00 48 83 7c 24 ... RSP: 0018:ffffabcb02803dd8 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000 RDX: ffff8e8808192880 RSI: 0000000000000000 RDI: ffff8e87c7509a68 RBP: 0000000000000000 R08: 0000000000000001 R09: 000000000000000a R10: 000000000000000a R11: f000000000000000 R12: 000000000000001f R13: ffff8e87c7509828 R14: ffff8e87c7509a68 R15: ffff8e88494527a0 FS: 00007f4db9151740(0000) GS:ffff8e8ebfec0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000028 CR3: 0000000166b66001 CR4: 00000000001706e0 Call Trace: <TASK> kernfs_fop_write_iter+0x11c/0x1b0 new_sync_write+0x10b/0x180 vfs_write+0x209/0x2a0 ksys_write+0x4f/0xc0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae The problem is that the device passed to clear_caseopen() is the hwmon device, not the platform device, and the platform data is not set in the hwmon device. Store the pointer to sio_data in struct nct6775_data and get if from there if needed. Fixes: 2e7b9886968b ("hwmon: (nct6775) Use superio_*() function pointers in sio_data.") Cc: Denis Pauk <pauk.denis@gmail.com> Cc: Bernhard Seibold <mail@bernhard-seibold.de> Reported-by: Paweł Marciniak <pmarciniak@lodz.home.pl> Tested-by: Denis Pauk <pauk.denis@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (adt7470) Prevent divide by zero in adt7470_fan_write()Dan Carpenter2022-01-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | The "val" variable is controlled by the user and comes from hwmon_attr_store(). The FAN_RPM_TO_PERIOD() macro divides by "val" so a zero will crash the system. Check for that and return -EINVAL. Negatives are also invalid so return -EINVAL for those too. Fixes: fc958a61ff6d ("hwmon: (adt7470) Convert to devm_hwmon_device_register_with_info API") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.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: (lm90) Fix sysfs and udev notificationsGuenter Roeck2022-01-231-6/+6
| | | | | | | | | | | | | | | | | | sysfs and udev notifications need to be sent to the _alarm attributes, not to the value attributes. Fixes: 94dbd23ed88c ("hwmon: (lm90) Use hwmon_notify_event()") Cc: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (lm90) Mark alert as broken for MAX6646/6647/6649Guenter Roeck2022-01-231-1/+1
| | | | | | | | | | | | | | | | | | Experiments with MAX6646 and MAX6648 show that the alert function of those chips is broken, similar to other chips supported by the lm90 driver. Mark it accordingly. Fixes: 4667bcb8d8fc ("hwmon: (lm90) Introduce chip parameter structure") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (lm90) Mark alert as broken for MAX6680Guenter Roeck2022-01-231-1/+1
| | | | | | | | | | | | | | | | | | Experiments with MAX6680 and MAX6681 show that the alert function of those chips is broken, similar to other chips supported by the lm90 driver. Mark it accordingly. Fixes: 4667bcb8d8fc ("hwmon: (lm90) Introduce chip parameter structure") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (lm90) Mark alert as broken for MAX6654Guenter Roeck2022-01-231-0/+1
| | | | | | | | | | | | | | | | | | Experiments with MAX6654 show that its alert function is broken, similar to other chips supported by the lm90 driver. Mark it accordingly. Fixes: 229d495d8189 ("hwmon: (lm90) Add max6654 support to lm90 driver") Cc: Josh Lehan <krellan@google.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (lm90) Re-enable interrupts after alert clearsGuenter Roeck2022-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If alert handling is broken, interrupts are disabled after an alert and re-enabled after the alert clears. However, if there is an interrupt handler, this does not apply if alerts were originally disabled and enabled when the driver was loaded. In that case, interrupts will stay disabled after an alert was handled though the alert handler even after the alert condition clears. Address the situation by always re-enabling interrupts after the alert condition clears if there is an interrupt handler. Fixes: 2abdc357c55d9 ("hwmon: (lm90) Unmask hardware interrupt") Cc: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (lm90) Reduce maximum conversion rate for G781Guenter Roeck2022-01-231-1/+1
|/ | | | | | | | | | | | | | | | | According to its datasheet, G781 supports a maximum conversion rate value of 8 (62.5 ms). However, chips labeled G781 and G780 were found to only support a maximum conversion rate value of 7 (125 ms). On the other side, chips labeled G781-1 and G784 were found to support a conversion rate value of 8. There is no known means to distinguish G780 from G781 or G784; all chips report the same manufacturer ID and chip revision. Setting the conversion rate register value to 8 on chips not supporting it causes unexpected behavior since the real conversion rate is set to 0 (16 seconds) if a value of 8 is written into the conversion rate register. Limit the conversion rate register value to 7 for all G78x chips to avoid the problem. Fixes: ae544f64cc7b ("hwmon: (lm90) Add support for GMT G781") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* Merge tag 'bitmap-5.17-rc1' of git://github.com/norov/linuxLinus Torvalds2022-01-231-2/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull bitmap updates from Yury Norov: - introduce for_each_set_bitrange() - use find_first_*_bit() instead of find_next_*_bit() where possible - unify for_each_bit() macros * tag 'bitmap-5.17-rc1' of git://github.com/norov/linux: vsprintf: rework bitmap_list_string lib: bitmap: add performance test for bitmap_print_to_pagebuf bitmap: unify find_bit operations mm/percpu: micro-optimize pcpu_is_populated() Replace for_each_*_bit_from() with for_each_*_bit() where appropriate find: micro-optimize for_each_{set,clear}_bit() include/linux: move for_each_bit() macros from bitops.h to find.h cpumask: replace cpumask_next_* with cpumask_first_* where appropriate tools: sync tools/bitmap with mother linux all: replace find_next{,_zero}_bit with find_first{,_zero}_bit where appropriate cpumask: use find_first_and_bit() lib: add find_first_and_bit() arch: remove GENERIC_FIND_FIRST_BIT entirely include: move find.h from asm_generic to linux bitops: move find_bit_*_le functions from le.h to find.h bitops: protect find_first_{,zero}_bit properly
| * Replace for_each_*_bit_from() with for_each_*_bit() where appropriateYury Norov2022-01-151-2/+1
| | | | | | | | | | | | | | | | | | | | A couple of kernel functions call for_each_*_bit_from() with start bit equal to 0. Replace them with for_each_*_bit(). No functional changes, but might improve on readability. Signed-off-by: Yury Norov <yury.norov@gmail.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
* | proc: remove PDE_DATA() completelyMuchun Song2022-01-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove PDE_DATA() completely and replace it with pde_data(). [akpm@linux-foundation.org: fix naming clash in drivers/nubus/proc.c] [akpm@linux-foundation.org: now fix it properly] Link: https://lkml.kernel.org/r/20211124081956.87711-2-songmuchun@bytedance.com Signed-off-by: Muchun Song <songmuchun@bytedance.com> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Alexey Gladkov <gladkov.alexey@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* | hwmon: (nzxt-smart2) make array detect_fans_report static constColin Ian King2022-01-091-1/+1
| | | | | | | | | | | | | | | | | | Don't populate the read-only array detect_fans_report on the stack but instead it static const. Also makes the object code a little smaller. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20220109194558.45811-1-colin.i.king@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (xgene-hwmon) Add free before exiting xgene_hwmon_probePeiwei Hu2021-12-281-2/+4
| | | | | | | | | | | | | | | | | | Call kfifo_free(&ctx->async_msg_fifo) before error exiting instead of returning directly. Signed-off-by: Peiwei Hu <jlu.hpw@foxmail.com> Link: https://lore.kernel.org/r/tencent_C851C0324431466CBC22D60C5C6AC4A8E808@qq.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (nzxt-smart2) Fix "unused function" warningAleksandr Mezin2021-12-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix warning when building with CONFIG_PM=n (and CONFIG_WERROR=y): drivers/hwmon/nzxt-smart2.c:707:12: error: ‘nzxt_smart2_hid_reset_resume’ defined but not used [-Werror=unused-function] 707 | static int nzxt_smart2_hid_reset_resume(struct hid_device *hdev) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com> Link: https://lore.kernel.org/r/20211228014813.832491-1-mezin.alexander@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (dell-smm) Pack the whole smm_regs structArmin Wolf2021-12-261-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | When desiring the whole struct to be packed, __packed should be applied to the whole struct, not just every struct member except the first one. Tested on a Dell Inspiron 3505. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20211221162805.104202-1-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | hwmon: (nct6775) Additional check for ChipID before ASUS WMI usageDenis Pauk2021-12-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | WMI monitoring methods can be changed or removed in new ASUS boards BIOS versions. Such versions return zero instead of a real one as Chip ID. Commit adds additional validation for the result of Chip ID call before enabling access by ASUS WMI methods. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Link: https://lore.kernel.org/r/20211218205206.615865-1-pauk.denis@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>