summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'hwmon-for-v6.7' of ↵Linus Torvalds2023-10-3150-395/+1748
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: "New drivers: - Driver for LTC2991 - Driver for POWER-Z Added chip / system support to existing drivers: - The ina238 driver now also supports INA237 - The asus-ec-sensors driver now supports ROG Crosshair X670E Gene - The aquacomputer_d5next now supports Aquacomputer High Flow USB and MPS Flow - The pmbus/mpq7932 driver now also supports MPQ2286 - The nct6683 now also supports ASRock X670E Taichi Various other minor improvements and fixes: - One patch series to call out is the conversion of hwmon platform drivers to use the platform remove callback returning void" * tag 'hwmon-for-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (69 commits) hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are connected hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow USB and MPS Flow dt-bindings: hwmon: npcm: Add npcm845 compatible string hwmon: Add driver for ltc2991 dt-bindings: hwmon: ltc2991: add bindings hwmon: (pmbus/max31785) Add delay between bus accesses hwmon: (ina238) add ina237 support dt-bindings: hwmon: ti,ina2xx: add ti,ina237 hwmon: (asus-ec-sensors) add ROG Crosshair X670E Gene. hwmon: (max31827) handle vref regulator hwmon: (ina3221) Add support for channel summation disable dt-bindings: hwmon: ina3221: Add ti,summation-disable dt-bindings: hwmon: ina3221: Convert to json-schema hwmon: (pmbus/mpq7932) Add a support for mpq2286 Power Management IC hwmon: (pmbus/core) Add helper macro to define single pmbus regulator regulator: dt-bindings: Add mps,mpq2286 power-management IC hwmon: (pmbus/mpq7932) Get page count based on chip info dt-bindings: hwmon: Add possible new properties to max31827 bindings hwmon: (max31827) Modify conversion wait time hwmon: (max31827) Make code cleaner ...
| * hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are ↵Aleksa Savic2023-10-291-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | connected Return -ENODATA if a temp sensor of a legacy device does not contain a reading. Originally-from: Leonard Anderweit <leonard.anderweit@gmail.com> Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com> Link: https://lore.kernel.org/r/20231016083559.139341-2-savicaleksa83@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow USB and ↵Aleksa Savic2023-10-291-4/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MPS Flow Extend aquacomputer_d5next driver to expose various hardware sensors of the Aquacomputer High Flow USB flow sensor, which communicates through a proprietary USB HID protocol. This commit also adds support for the sensors of the MPS Flow devices, as they have the same USB product ID and sensor layouts. Implemented by Leonard Anderweit [1]. Internal and external temp sensor readings are available, along with the flow sensor. Additionally, serial number and firmware version are exposed through debugfs. [1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/90 Originally-from: Leonard Anderweit <leonard.anderweit@gmail.com> Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com> Link: https://lore.kernel.org/r/20231016083559.139341-3-savicaleksa83@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: Add driver for ltc2991Antoniu Miclaus2023-10-293-0/+449
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for LTC2991 Octal I2C Voltage, Current, and Temperature Monitor. The LTC2991 is used to monitor system temperatures, voltages and currents. Through the I2C serial interface, the eight monitors can individually measure supply voltages and can be paired for differential measurements of current sense resistors or temperature sensing transistors. Additional measurements include internal temperature and internal VCC. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://lore.kernel.org/r/20231026103413.27800-2-antoniu.miclaus@analog.com [groeck: Fixed up documentation warning] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pmbus/max31785) Add delay between bus accessesLakshmi Yadlapati2023-10-281-21/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MAX31785 has shown erratic behaviour across multiple system designs, unexpectedly clock stretching and NAKing transactions. Experimentation shows that this seems to be triggered by a register access directly back to back with a previous register write. Experimentation also shows that inserting a small delay after register writes makes the issue go away. Use a similar solution to what the max15301 driver does to solve the same problem. Create a custom set of bus read and write functions that make sure that the delay is added. Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com> Link: https://lore.kernel.org/r/20231027044346.2167548-1-lakshmiy@us.ibm.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (ina238) add ina237 supportRichard Leitner2023-10-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The INA237 "85-V, 16-Bit, Precision Power Monitor With I2C Interface" is basically the same as INA328. Therefore add a corresponding compatible to the driver. According to the datasheet the main difference is the current and power monitoring accuracy: +------------------------+---------------+---------------+ | | INA238 | INA237 | +------------------------+---------------+---------------+ | Offset voltage | +/- 5µV | +/- 50µV | | Offset drift | +/- 0.02µV/°C | +/- 0.02µV/°C | | Gain error | +/- 0.1% | +/- 0.3% | | Gain error drift | +/- 25ppm/°C | +/- 50ppm/°C | | Common mode rejection | 140dB | 120dB | | Power accuracy | 0.7% | 1.6% | +------------------------+---------------+---------------+ As well as the missing DEVICE_ID register at 0x3F, which is currently not in use by the driver. Signed-off-by: Richard Leitner <richard.leitner@linux.dev> Link: https://lore.kernel.org/r/20231026-ina237-v2-1-dec44811a3c9@linux.dev Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (asus-ec-sensors) add ROG Crosshair X670E Gene.Ellie Hermaszewska2023-10-281-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Only the temp sensors that I can verify are present. T_Sensor is the temperature reading of a 10kΩ β=3435K NTC thermistor optionally connected to the T_SENSOR header. The other sensors are as found on the X670E Hero. Signed-off-by: Ellie Hermaszewska <kernel@monoid.al> Link: https://lore.kernel.org/r/20231026104332.906357-1-kernel@monoid.al Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max31827) handle vref regulatorAntoniu Miclaus2023-10-281-0/+4
| | | | | | | | | | | | | | | | | | Add missing implementation for the max31827 supply regulator. This is a hardware required property that is not handled. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://lore.kernel.org/r/20230925122929.10610-1-antoniu.miclaus@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (ina3221) Add support for channel summation disableNinad Malwade2023-10-281-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The INA3221 allows the Critical alert pin to be controlled by the summation control function. This function adds the single shunt-voltage conversions for the desired channels in order to compare the combined sum to the programmed limit. The Shunt-Voltage Sum Limit register contains the programmed value that is compared to the value in the Shunt-Voltage Sum register in order to determine if the total summed limit is exceeded. If the shunt-voltage sum limit value is exceeded, the Critical alert pin pulls low. For the summation limit to have a meaningful value, we have to use the same shunt-resistor value on all included channels. Unless equal shunt-resistor values are used for each channel, the summation control function cannot be used and it is not enabled by the driver. To address this, add support to disable the summation of specific channels via device tree property "ti,summation-disable". The channel which has this property would be excluded from the calculation of summation control function. For example, summation control function calculates Shunt-Voltage Sum as: - input_shunt_voltage_summation = input_shunt_voltage_channel1 + input_shunt_voltage_channel2 + input_shunt_voltage_channel3 If we want the summation to only use channel1 and channel3, we can add 'ti,summation-disable' property in device tree node for channel2. Then the calculation will skip channel2. - input_shunt_voltage_summation = input_shunt_voltage_channel1 + input_shunt_voltage_channel3 Note that we only want the channel to be skipped for summation control function rather than completely disabled. Therefore, even if we add the property 'ti,summation-disable', the channel is still enabled and functional. Finally, create debugfs entries that display if summation is disabled for each of the channels. Signed-off-by: Rajkumar Kasirajan <rkasirajan@nvidia.com> Signed-off-by: Ninad Malwade <nmalwade@nvidia.com> Co-developed-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20230929103650.86074-4-jonathanh@nvidia.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pmbus/mpq7932) Add a support for mpq2286 Power Management ICSaravanan Sekar2023-10-281-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | The MPQ2286 is a programmable, high frequency synchronous buck regulator designed to power a variety of Automotive system peripherals. Single buck converters with hardware monitoring capability is configurable over PMBus interface. Signed-off-by: Saravanan Sekar <saravanan@linumiz.com> Link: https://lore.kernel.org/r/20231011164754.449399-5-saravanan@linumiz.com [groeck: Updated subject (mpq2286 -> mpq7932)] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pmbus/core) Add helper macro to define single pmbus regulatorSaravanan Sekar2023-10-281-0/+15
| | | | | | | | | | | | | | | | | | | | The bindings for single instance regulator should be named with no instance (e.g., buck not buck0). Introduce a new helper macro to define the single pmbus regulator. Signed-off-by: Saravanan Sekar <saravanan@linumiz.com> Link: https://lore.kernel.org/r/20231011164754.449399-4-saravanan@linumiz.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pmbus/mpq7932) Get page count based on chip infoSaravanan Sekar2023-10-281-3/+3
| | | | | | | | | | | | | | | | | | Get page count using compatible match to support the series of chipsets which differs in number of regualator/page. Signed-off-by: Saravanan Sekar <saravanan@linumiz.com> Link: https://lore.kernel.org/r/20231011164754.449399-2-saravanan@linumiz.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max31827) Modify conversion wait timeDaniel Matyas2023-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | There is nothing in the datasheet indicating that the 1ms error is needed and I didn't encounter any error during testing with 140ms wait time. Signed-off-by: Daniel Matyas <daniel.matyas@analog.com> Link: https://lore.kernel.org/r/20230919093456.10592-2-daniel.matyas@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max31827) Make code cleanerDaniel Matyas2023-10-281-69/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Used enums and while loops to replace switch for selecting and getting update interval from conversion rate bits. Divided the write_alarm_val function into 2 functions. The new function is more generic: it can be used not only for alarm writes, but for any kind of writes which require the device to be in shutdown mode. Signed-off-by: Daniel Matyas <daniel.matyas@analog.com> Link: https://lore.kernel.org/r/20230919093456.10592-1-daniel.matyas@analog.com [groeck: Reverted error return value change (EOPNOTSUPP -> EINVAL)] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (nct6683) Add another customer ID for ASRock X670E TaichiAlexander Koskovich2023-10-281-0/+3
| | | | | | | | | | | | | | | | | | This value was found on an ASRock X670E Taichi with an NCT6686D chip. Signed-off-by: Alexander Koskovich <akoskovich@pm.me> Link: https://lore.kernel.org/r/20231023182442.21943-1-akoskovich@pm.me Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (ltc2992) Avoid division by zeroAntoniu Miclaus2023-10-281-1/+5
| | | | | | | | | | | | | | | | | | | | Do not allow setting shunt resistor to 0. This results in a division by zero when performing current value computations based on input voltages and connected resistor values. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://lore.kernel.org/r/20231011135754.13508-1-antoniu.miclaus@analog.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (npcm750-pwm) Add an error code check in npcm7xx_en_pwm_fanSu Hui2023-10-281-0/+2
| | | | | | | | | | | | | | | | | | npcm7xx_pwm_config_set() can return '-ENODEV' for failed. So check the value of 'ret' after calling npcm7xx_pwm_config_set(). Signed-off-by: Su Hui <suhui@nfschina.com> Link: https://lore.kernel.org/r/20231020085518.198477-1-suhui@nfschina.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (hs3001) remove redundant store on divisionColin Ian King2023-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the local variable hum is being divided by a constant and the results is being re-assigned back to hum before the value is being returned to the caller. The assignment to hum is redundant and can be removed. Cleans up clang scan build warning: drivers/hwmon/hs3001.c:65:9: warning: Although the value stored to 'hum' is used in the enclosing expression, the value is never actually read from 'hum' [deadcode.DeadStores] Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20231023135828.667297-1-colin.i.king@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (nct6775) use acpi_dev_hid_uid_match() for matching _HID and _UIDRaag Jadav2023-10-281-3/+1
| | | | | | | | | | | | | | | | Convert manual _UID references to use the standard ACPI helper. Signed-off-by: Raag Jadav <raag.jadav@intel.com> Link: https://lore.kernel.org/r/20231024062018.23839-6-raag.jadav@intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (adt7475) Add support for Imon readout on ADT7490Timothy Pearson2023-10-271-6/+62
| | | | | | | | | | | | | | | | | | | | | | Add support for the ADT7490's Imon voltage readout. It is handled largely the same way as the existing Vtt readout. Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com> Co-developed-by: Shawn Anastasio <sanastasio@raptorengineering.com> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com> Link: https://lore.kernel.org/r/20230914223947.829025-1-tpearson@raptorengineering.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (powerz) add support for ChargerLAB KM002CThomas Weißschuh2023-10-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | The KM002C is similar to the KM003C and seems to use the same protocol and firmware. Reported-by: Douglas Gilbert <dgilbert@interlog.com> Closes: https://lore.kernel.org/lkml/290ebce4-54f0-8ac1-2a13-cbc806d80d64@interlog.com/ Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20230911-powerz-km002c-v1-1-898bd79b9bae@weissschuh.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (xgene-hwmon) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-25-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (w83781d) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-24-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (w83627hf) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-23-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (vt8231) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-22-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (vt1211) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-21-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (via686a) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-20-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (via-cputemp) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-19-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (ultra45_env) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-18-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (sis5595) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-17-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (sht15) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-16-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (sch5636) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-15-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pc87427) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-14-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pc87360) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-13-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (occ/p9_sbe) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-12-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (mc13783-adc) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-11-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max197) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-10-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (i5k_amb) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-9-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (f71882fg) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-8-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (f71805f) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-7-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (dme1737) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-6-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (da9052-hwmon) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-5-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (abituguru3) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918085951.1234172-4-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (abituguru) Convert to platform remove callback returning voidUwe Kleine-König2023-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20230918085951.1234172-3-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (abitguru{,3}) Enable build testing on !X86Uwe Kleine-König2023-10-271-2/+2
| | | | | | | | | | | | | | | | | | | | The two drivers compile fine on arm64, powerpc, m68k and s390. So make it possible to enable the drivers in the presence of COMPILE_TEST. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20230918085951.1234172-2-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (sch5627) Add support for writing limit registersArmin Wolf2023-10-273-55/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After some testing on a Fujitsu Esprimo P720, it turned out that the limit registers are indeed writable and affect the fan control algorithm. This is supported by the datasheet, which says that the fan control functions are based on the limit and parameter registers. Since accessing those registers is very inefficient, the existing regmap cache is used to cache those registers values. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20230907052639.16491-5-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (sch5627) Use regmap for pwm map register cachingArmin Wolf2023-10-274-14/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | Accessing virtual registers is very inefficient, so pwm map values should be cached when possible, else userspace could effectively do a DOS attack by reading pwm map values in a while loop. Use the regmap cache to cache those values. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20230907052639.16491-4-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (sch5627) Disallow write access if virtual registers are lockedArmin Wolf2023-10-271-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | When the lock bit inside SCH5627_REG_CTRL is set, then the virtual registers become read-only until the next power cycle. Disallow write access to those registers in such a case. Tested on a Fujitsu Esprimo P720. Fixes: aa9f833dfc12 ("hwmon: (sch5627) Add pwmX_auto_channels_temp support") Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20230907052639.16491-3-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (sch5627) Use bit macros when accessing the control registerArmin Wolf2023-10-271-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | Use bit macros then accessing SCH5627_REG_CTRL, so that people do not need to look at the datasheet to find out what each bit does. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20230907052639.16491-2-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: tmp513: Simplify tmp51x_read_properties()Biju Das2023-10-271-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | Simplify tmp51x_read_properties() by replacing 'nfactor' ->'data->nfactor' in device_property_read_u32_array() and drop the local variable as it is unused. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230907071404.24334-3-biju.das.jz@bp.renesas.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>