Commit Graph

21 Commits

Author SHA1 Message Date
Linus Torvalds 0baf6dcc02 hwmon updates for v6.1
* New drivers
 
   - Driver for MAX31760 fan speed controller
 
   - Driver for TEXAS TPS546D24 Buck Converter
 
   - Driver for EMC2301/2/3/5 RPM-based PWM Fan Speed Controller
 
 * Removed drivers
 
   - Drop obsolete asus_wmi_ec_sensors driver
 
 * Cleanups, affecting various drivers
 
   - Use DEFINE_SIMPLE_DEV_PM_OPS where appropriate
 
   - Remove forward declarations
 
   - Move from strlcpy with unused retval to strscpy
 
   - Make use of devm_clk_get_enabled()
 
   - Drop devm_of_pwm_get()
 
 * Other notable cleanup and improvements
 
   - Support for additional USB devide ID and support for reporting
     of rail mode via debugfs added to corsair-psu driver
 
   - Support for aditional USB ID in nzxt-smart2 driver
 
   - Support for Aquacomputer High Flow Next in aquacomputer_d5next driver
 
   -  Major cleanup of pwm-fan driver
 
   -  Major cleanup of mr75203 driver, and added support for new device revision
 
 * Various other minor fixes and cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmM6CSsACgkQyx8mb86f
 mYEwFw//SvJ5vW/bS0kynaH2TICzwHDHjH7nBjXyIlqN3ILrrTKyFQgkfqIlqYT9
 OYlXaKB6DqRBOZjLCYKNhDy13gdvOh0XBIsX/emqzFDmhGZ6yJtm0u+6CMp7UFGK
 3KDf4LSkEJ3QhgOOiROsz1u6CSXdZI8THnIBRCrzve3nlamRaR6n8tvvf6Fqspsa
 WQTDg1g2dOjpP6bi1EKre/KiBfjxrzy2/r9WGQr1J7LZb598/F7CPGztJU6P27TE
 gHltO4wcAgBgnL3ODBmLPDHyAa91fTmfHCvKRUfaAlZll8ucfXJnlfZVV8YW9ptC
 Fm00Wmy8aFX57ziXFlJ7LOFdjdCKyTRVp5ferPHCEuzmztWLdWauwiVV7GkeqzIB
 /seHcC59kX7yGKgP2sYV9SlD0GWa2Ax2rJT8gh78ozUgXMUlKkVPSly5ooOaKkEV
 nNRLJB40tAK43wwSWNVSw0wPXK0fWfxmyF1AMowNEoC12zDLO0JAlw/sVXj4GneG
 sq0ZN6vyAaDdcX3RKan6jTaus2AdHf3vZHqy/xW59Jo+JqoxF7zo1MLRDP2EekWn
 x0HbXT5ghWrmntN7mgRPvN1sgebK8L+yGttuJ/guFuYTTy8FrXOKtjhBCcvZHg7C
 tiMUAMTl7s6FujcuMEY84ZwwIDczLGpIwxXammIKJiHGBSeHsdk=
 =8u0w
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon updates from Guenter Roeck:
 "New drivers:

   - Driver for MAX31760 fan speed controller

   - Driver for TEXAS TPS546D24 Buck Converter

   - Driver for EMC2301/2/3/5 RPM-based PWM Fan Speed Controller

  Removed drivers:

   - Drop obsolete asus_wmi_ec_sensors driver

  Cleanups, affecting various drivers:

   - Use DEFINE_SIMPLE_DEV_PM_OPS where appropriate

   - Remove forward declarations

   - Move from strlcpy with unused retval to strscpy

   - Make use of devm_clk_get_enabled()

   - Drop devm_of_pwm_get()

  Other notable cleanup and improvements:

   - Support for additional USB devide ID and support for reporting of
     rail mode via debugfs added to corsair-psu driver

   - Support for aditional USB ID in nzxt-smart2 driver

   - Support for Aquacomputer High Flow Next in aquacomputer_d5next
     driver

   - Major cleanup of pwm-fan driver

   - Major cleanup of mr75203 driver, and added support for new device
     revision

  And various other minor fixes and cleanups"

* tag 'hwmon-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (86 commits)
  hwmon: (corsair-psu) add USB id of new revision of the HX1000i psu
  hwmon: (pmbus/mp2888) Fix sensors readouts for MPS Multi-phase mp2888 controller
  dt-bindings: hwmon: sensirion,shtc1: Clean up spelling mistakes and grammar
  hwmon: (nct6683) remove unused variable in nct6683_create_attr_group
  hwmon: w83627hf: Reorder symbols to get rid of a few forward declarations
  hwmon: (ina3221) Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
  hwmon: (w83627ehf) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (tmp108) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (tmp103) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (tmp102) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (pwm-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (nct6775) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (max6639) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (max31730) witch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (max31722) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (ltc2947) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (lm90) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (it87) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  ...
2022-10-04 19:02:54 -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
Uwe Kleine-König ed5c2f5fd1 i2c: Make remove callback return void
The value returned by an i2c driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2022-08-16 12:46:26 +02:00
Paul Fertser 952a11ca32 hwmon: cleanup non-bool "valid" data fields
We have bool so use it consistently in all the drivers.

The following Coccinelle script was used:

@@
identifier T;
type t = { char, int };
@@
struct T {
...
-	t valid;
+	bool valid;
...
}

@@
identifier v;
@@
(
- v->valid = 0
+ v->valid = false
|
- v->valid = 1
+ v->valid = true
)

followed by sed to fixup the comments:
sed '/bool valid;/{s/!=0/true/;s/zero/false/}'

Few whitespace changes were fixed manually. All modified drivers were
compile-tested.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Link: https://lore.kernel.org/r/20210924195202.27917-1-fercerpav@gmail.com
[groeck: Fixed up 'u8 valid' to 'boool valid' in atxp1.c]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-10-12 07:22:41 -07:00
Stephen Kitt 7dedb79d29 hwmon: (asc7621) use simple i2c probe
This driver doesn't use the id information provided by the old i2c
probe function, so it can trivially be converted to the simple
("probe_new") form.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20200813162544.1516647-1-steve@sk2.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2020-09-23 09:42:40 -07:00
Thomas Gleixner 74ba9207e1 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation either version 2 of the license or at
  your option any later version this program is distributed in the
  hope that it will be useful but without any warranty without even
  the implied warranty of merchantability or fitness for a particular
  purpose see the gnu general public license for more details you
  should have received a copy of the gnu general public license along
  with this program if not write to the free software foundation inc
  675 mass ave cambridge ma 02139 usa

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 441 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24 17:36:45 +02:00
Colin Ian King a3bdc5b5bd hwmon: (asc7621) remove redundant assignment to newval
The setting of newval to zero is redundant as the following if/else
stanzas will always update newval to a new value. Remove the
redundant setting, cleans up clang build warning:

drivers/hwmon/asc7621.c:582:2: warning: Value stored to 'newval' is
never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-10-29 18:36:03 -07:00
Colin Ian King 6930125858 hwmon: (asc7621) make several arrays static const
Don't populate the arrays on the stack, instead make them static.
Makes the object code smaller by over 950 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  26144	  18768	    352	  45264	   b0d0	drivers/hwmon/asc7621.o

After:
   text	   data	    bss	    dec	    hex	filename
  25029	  18928	    352	  44309	   ad15	drivers/hwmon/asc7621.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-08-30 06:31:49 -07:00
Axel Lin 7a7176aa4b hwmon: (asc7621) Make map tables const
Map tables are never changed, so it is safe to make them const.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: George Joseph <george.joseph@fairview5.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-08-04 07:01:38 -07:00
Jean Delvare 6cf0a91ebe hwmon: Avoid initializing the same field twice
All hwmon drivers allocate their data structure with some form of
kzalloc, so setting data fields to zero explicitly is a waste of time.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2014-04-04 18:01:34 +02:00
Guenter Roeck a039371353 hwmon: Remove unnecessary semicolons
Semicolons after closing } of conditional blocks are not needed
and can be removed.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
2013-10-13 16:16:25 -07:00
Guenter Roeck 088ce2ac9e hwmon: Fix CamelCase checkpatch warnings
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07 21:16:40 -07:00
Guenter Roeck 2a844c148e hwmon: Replace SENSORS_LIMIT with clamp_val
SENSORS_LIMIT and the generic clamp_val have the same functionality,
and clamp_val is more efficient.

This patch reduces text size by 9052 bytes and bss size by 11624 bytes
for x86_64 builds.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: George Joseph <george.joseph@fairview5.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
2013-01-25 21:03:54 -08:00
Guenter Roeck 35bb95a17a hwmon: (asc7621) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.

Cc: George Joseph <george.joseph@fairview5.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: George Joseph <george.joseph@fairview5.com>
2012-07-21 21:48:40 -07:00
Guenter Roeck 3c56b066fb hwmon: (asc7621) Fix multi-line comments
Cc: George Joseph <george.joseph@fairview5.com>
Acked-by: George Joseph <george.joseph@fairview5.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-18 18:26:54 -07:00
Frans Meulenbroeks 179c4fdb56 hwmon: replaced strict_str* with kstr*
replaced strict_strtol with kstrtol and
replaced strict_strtuol with kstrtuol

This satisfies checkpatch -f
Compile tested only: no warnings or errors given

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-01-05 08:19:34 -08:00
Jean Delvare 918ee91c07 hwmon: I2C addresses are constant
We can mark normal_i2c const. Almost all drivers do that already, so
fix the 3 remaining ones before they are used as (bad) examples for
new drivers.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: George Joseph <george.joseph@fairview5.com>
Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:50 +02:00
Jean Delvare 28cbd461f0 hwmon: (asc7621) Clean up and improve detect function
* The dev variable is never used.
* Detect functions only need to set info->type, not client->name.
* Include the device address in the log message.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: George Joseph <george.joseph@fairview5.com>
Cc: Ken Milmore <ken.milmore@googlemail.com>
2010-08-14 21:08:52 +02:00
Wolfram Sang fbae3fb154 i2c: Remove all i2c_set_clientdata(client, NULL) in drivers
I2C drivers can use the clientdata-pointer to point to private data. As I2C
devices are not really unregistered, but merely detached from their driver, it
used to be the drivers obligation to clear this pointer during remove() or a
failed probe(). As a couple of drivers forgot to do this, it was agreed that it
was cleaner if the i2c-core does this clearance when appropriate, as there is
no guarantee for the lifetime of the clientdata-pointer after remove() anyhow.
This feature was added to the core with commit
e4a7b9b04d to fix the faulty drivers.

As there is no need anymore to clear the clientdata-pointer, remove all current
occurrences in the drivers to simplify the code and prevent confusion.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Richard Purdie <rpurdie@linux.intel.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-06-03 11:33:58 +02:00
Ken Milmore d1bf8cf6b9 hwmon: (asc7621) Bug fixes
* Allow fan minimum RPM to be set to zero without triggering alarms.
* Fix voltage scaling arithmetic and correct scale factors.
* Correct fan1-fan4 alarm bit shifts.
* Correct register address for temp3_smoothing_enable.
* Read the alarm registers with high priority.

Signed-off-by: Ken Milmore <ken.milmore@googlemail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-05-11 09:17:46 +02:00
George Joseph d58de03872 hwmon: Driver for Andigilog aSC7621 family monitoring chips
Hwmon driver for Andigilog aSC7621 family monitoring chips.

Signed-off-by: George Joseph <george.joseph@fairview5.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-03-05 22:17:25 +01:00