Commit Graph

5582 Commits

Author SHA1 Message Date
Linus Torvalds
500a711df6 hwmon updates for v6.11-rc1
* Obsolete driver removals
 
   - Removed obsolete adm1021 and max6642 drivers
 
 * New drivers
 
   - MPS MP2891
 
   - MPS MP2993
 
   - MPS MP9941
 
   - MPS MP5920
 
   - SPD5118 (Temperature Sensor and EEPROM)
 
 * Added device support to existing drivers
 
   - g762: G761
 
   - dell-smm: Dell OptiPlex 7060
 
   - asus-ec-sensors: ProArt X670E-CREATOR WIFI
 
   - corsair-psu: HX1200i Series 2023 psu
 
   - nzxt-smart2: Additional USB IS for NZXT RGB & Fan Controller
 
 * Notable enhancements and fixes
 
   - Removed use of i2c_match_id()
 
   - Constified struct regmap_config where feasible
 
   - Cleaned up amc6821 driver, and converted to use regmap and with_info API
 
   - Converted max6639 driver to use with_info API; added support for
     additional sysfs attributes
 
   - Fixed various sysfs attribute underflows
 
   - Added PEC support to hwmon core, and use in lm90 and max31827 drivers
 
 * Various other minor fixes and improvements
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmaUaiIACgkQyx8mb86f
 mYHnbRAAhyaqFF1w5B/XEuZOQ3obG+pAV1ZioE7wXpeRDlniJ9/WgFe4bPpvTNQm
 C2LHW6kVtwxybM/FOJz9BN32WiP9v2kp9upb7hhHHo32+5dv57iQR5lB+JC/7lpy
 HLisqLrPc5eDQlUiOdeph5fsKyuydxQkefbR1x4shxmcgn+D5M+AYjuAZOA6fSun
 spSzgTyPGWgGfhQjSzKoA7DHG3S2pFxRTfqOArvKLOM+ahyOCFuS8Kbq/JpqvalB
 moiyIJUeOrgJcTcHSecQ/uFxFiShGBs6EQ1Ao8O9kO0WFw7ke1fw/fWESeTvtiBm
 0Z3zfqAIKcnCXvKEupltWXf6kASx5LSlycODTZQlXEROeYhzhJw3J5qF4h0r4+EM
 oKmptVLLLekVYrjQlarBtHqpdfnwsL1GuQTk5fZz7ZbG85/ktKV6aGTeKGYdBvll
 zZSjz3Jys2u191uxATpJ3vmjaggPylX6dXgmJ9u9lW16+/OnNq7sWURekIfE3F+P
 dpZsaia2KN3WAnX/qLQWOOOBbkIIGxn48e+Hi6QY9igVUbY+P/BBfhb9UiWonLKU
 exRxAFNV5a4nM0ipJF4odwMqzC9ZjrpY6zFQFZCrG79zOO62/gADUAVzwu2LGGig
 p6hqGJmEOkJgYd0zo8KP8ABwgffn8EAtgXBtQU0RS/ls7Z0S58U=
 =ebWS
 -----END PGP SIGNATURE-----

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

Pull hwmon updates from Guenter Roeck:
 "Obsolete driver removals:

   - Removed obsolete adm1021 and max6642 drivers

  New drivers:

   - MPS MP2891, MP2993, MP9941, and MP5920

   - SPD5118 (Temperature Sensor and EEPROM)

  Added device support to existing drivers:

   - g762: G761

   - dell-smm: Dell OptiPlex 7060

   - asus-ec-sensors: ProArt X670E-CREATOR WIFI

   - corsair-psu: HX1200i Series 2023 psu

   - nzxt-smart2: Additional USB IS for NZXT RGB & Fan Controller

  Notable enhancements and fixes:

   - Removed use of i2c_match_id()

   - Constified struct regmap_config where feasible

   - Cleaned up amc6821 driver, and converted to use regmap and
     with_info API

   - Converted max6639 driver to use with_info API; added support for
     additional sysfs attributes

   - Fixed various sysfs attribute underflows

   - Added PEC support to hwmon core, and use in lm90 and max31827
     drivers

  And various other minor fixes and improvements"

* tag 'hwmon-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (103 commits)
  hwmon: (max6697) Fix swapped temp{1,8} critical alarms
  hwmon: (max6697) Fix underflow when writing limit attributes
  hwmon: Remove obsolete adm1021 and max6642 drivers
  hwmon: (pmbus/ltc4286) Drop unused i2c device ids
  hwmon: (g762) Initialize fans after configuring clock
  hwmon: (amc6821) Add support for pwm1_mode attribute
  hwmon: (amc6821) Convert to with_info API
  hwmon: (amc6821) Convert to use regmap
  hwmon: (amc6821) Drop unnecessary enum chips
  hwmon: (amc6821) Use BIT() and GENMASK()
  hwmon: (amc6821) Use tabs for column alignment in defines
  hwmon: (amc6821) Reorder include files, drop unnecessary ones
  hwmon: (amc6821) Add support for fan1_target and pwm1_enable mode 4
  hwmon: (amc6821) Rename fan1_div to fan1_pulses
  hwmon: (amc6821) Make reading and writing fan speed limits consistent
  hwmon: (amc6821) Stop accepting invalid pwm values
  hwmon: (w83627ehf) Fix underflows seen when writing limit attributes
  hwmon: (nct6775-core) Fix underflows seen when writing limit attributes
  hwmon: (lm95234) Fix underflows seen when writing limit attributes
  hwmon: (adc128d818) Fix underflows seen when writing limit attributes
  ...
2024-07-15 17:39:13 -07:00
Linus Torvalds
89c4913893 chrome platform changes for 6.11
* New
 
   - Add "cros_ec_hwmon" driver to expose fan speed and temperature.
 
   - Add "cros_charge-control" driver to control charge thresholds and
     behaviour.
 
   - Add module parameter "log_poll_period_ms" in cros_ec_debugfs for
     tuning the poll period.
 
   - Support version 3 of EC_CMD_GET_NEXT_EVENT and keyboard matrix.
 
 * Fixes
 
   - Fix a race condition in accessing MEC (Microchip EC) memory between
     ACPI and kernel.  Serialize the memory access by an AML (ACPI
     Machine Language) mutex.
 
   - Fix an issue of wrong EC message version in cros_ec_debugfs.
 
 * Misc
 
   - Fix kernel-doc errors and cleanups.
 -----BEGIN PGP SIGNATURE-----
 
 iIkEABYKADEWIQS0yQeDP3cjLyifNRUrxTEGBto89AUCZo04zBMcdHp1bmdiaUBr
 ZXJuZWwub3JnAAoJECvFMQYG2jz0bf0BAOjE7APATFsKLuFmtKxk/1XlsspsRTWK
 vocdNAKuj9I5AQCdcrHcDreLz5ldqodCpOc4TXiZoLHIkELNQcQtOorhDw==
 =To8o
 -----END PGP SIGNATURE-----

Merge tag 'tag-chrome-platform-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Tzung-Bi Shih:
 "New code:

   - Add "cros_ec_hwmon" driver to expose fan speed and temperature

   - Add "cros_charge-control" driver to control charge thresholds and
     behaviour

   - Add module parameter "log_poll_period_ms" in cros_ec_debugfs for
     tuning the poll period

   - Support version 3 of EC_CMD_GET_NEXT_EVENT and keyboard matrix

  Fixes:

   - Fix a race condition in accessing MEC (Microchip EC) memory between
     ACPI and kernel. Serialize the memory access by an AML (ACPI
     Machine Language) mutex

   - Fix an issue of wrong EC message version in cros_ec_debugfs

  Misc:

   - Fix kernel-doc errors and cleanups"

* tag 'tag-chrome-platform-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: (28 commits)
  power: supply: cros_charge-control: Fix signedness bug in charge_behaviour_store()
  power: supply: cros_charge-control: Avoid accessing attributes out of bounds
  power: supply: cros_charge-control: don't load if Framework control is present
  power: supply: add ChromeOS EC based charge control driver
  platform/chrome: cros_ec_proto: Introduce cros_ec_get_cmd_versions()
  platform/chrome: Update binary interface for EC-based charge control
  ACPI: battery: add devm_battery_hook_register()
  dt-bindings: input: cros-ec-keyboard: Add keyboard matrix v3.0
  platform/chrome: cros_ec_lpc: Handle zero length read/write
  platform/chrome: cros_ec_lpc: Fix error code in cros_ec_lpc_mec_read_bytes()
  platform/chrome: cros_ec_debugfs: fix wrong EC message version
  platform/chrome: cros_ec_proto: update Kunit test for get_next_data_v3
  platform/chrome: cros_ec_proto: add missing MODULE_DESCRIPTION() macro
  hwmon: (cros_ec) Fix access to restricted __le16
  hwmon: (cros_ec) Prevent read overflow in probe()
  platform/chrome: cros_ec_lpc: Add quirks for Framework Laptop
  platform/chrome: cros_ec_lpc: Add a new quirk for AML mutex
  platform/chrome: cros_ec_lpc: Add a new quirk for ACPI id
  platform/chrome: cros_ec_lpc: MEC access can use an AML mutex
  platform/chrome: cros_ec_lpc: MEC access can return error code
  ...
2024-07-15 17:25:38 -07:00
Guenter Roeck
1ea3fd1eb9 hwmon: (max6697) Fix swapped temp{1,8} critical alarms
The critical alarm bit for the local temperature sensor (temp1) is in
bit 7 of register 0x45 (not bit 6), and the critical alarm bit for remote
temperature sensor 7 (temp8) is in bit 6 (not bit 7).

This only affects MAX6581 since all other chips supported by this driver
do not support those critical alarms.

Fixes: 5372d2d71c ("hwmon: Driver for Maxim MAX6697 and compatibles")
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-14 11:49:01 -07:00
Guenter Roeck
cbf7467828 hwmon: (max6697) Fix underflow when writing limit attributes
Using DIV_ROUND_CLOSEST() on an unbound value can result in underflows.
Indeed, module test scripts report:

temp1_max: Suspected underflow: [min=0, read 255000, written -9223372036854775808]
temp1_crit: Suspected underflow: [min=0, read 255000, written -9223372036854775808]

Fix by introducing an extra set of clamping.

Fixes: 5372d2d71c ("hwmon: Driver for Maxim MAX6697 and compatibles")
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-14 11:48:50 -07:00
Guenter Roeck
ed99ae74f2 hwmon: Remove obsolete adm1021 and max6642 drivers
ADM1021, MAX6642, and compatible chips are supported by the lm90 driver.
Remove the obsolete stand-alone drivers to reduce maintenance overhead.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-14 11:48:43 -07:00
Uwe Kleine-König
04e3bb0b00 hwmon: (pmbus/ltc4286) Drop unused i2c device ids
The driver doesn't make use of the different numbers assigned to the
different devices. So drop them.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/9a48ba0368e0c8cddc94c5e4cf3edd7eadc03a2d.1720600141.git.u.kleine-koenig@baylibre.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-10 07:11:34 -07:00
Guenter Roeck
f4a180247e hwmon: (g762) Initialize fans after configuring clock
Adding support for G761 included adding support for an internal clock.
Enabling the internal clock requires setting a bit in the FAN_CMD2
register. This is implemented in g762_fan_init(). However, g762_fan_init()
is called before clock support is selected, and the flag indicating that
the internal clock should be used is not yet set.

Initialize the clock before initializing the fan to solve the problem.
While at it, also add "g7621" to the i2c_device_id array.

Cc: Christian Marangi <ansuelsmth@gmail.com>
Fixes: 6ce402327a ("hwmon: g672: add support for g761")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-09 15:45:48 -07:00
Guenter Roeck
4814241a58 hwmon: (amc6821) Add support for pwm1_mode attribute
AMC6821 supports configuring if a fan is DC or PWM controlled.
Add support for the pwm1_mode attribute to make it runtime configurable.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
e98ab50e1f hwmon: (amc6821) Convert to with_info API
Convert to use with_info API to simplify the code and make it easier
to maintain. This also reduces code size by approximately 20%.

No functional change intended.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
a051d507ba hwmon: (amc6821) Convert to use regmap
Use regmap for register accesses and caching.

While at it, use sysfs_emit() instead of sprintf() to write sysfs
attribute data, and remove spurious debug messages which would only
be seen as result of a bug in the code. Also make sure that error
codes are propagated and not replaced with -EIO.

While at it, introduce rounding of written temperature values and for
internal calculations to reduce deviation from written values and as
much as possible.

No functional change intended except for differences introduced by
rounding.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
8d061050fd hwmon: (amc6821) Drop unnecessary enum chips
The driver only supports a single chip, so an enum
to determine the chip type is unnecessary. Drop it.

No functional change intended.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
a9c2f41f02 hwmon: (amc6821) Use BIT() and GENMASK()
Use BIT() and GENMASK() for bit and mask definitions
to help distinguish bit and mask definitions from other
defines and to make the code easier to read.

No functional change intended.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
d632e82993 hwmon: (amc6821) Use tabs for column alignment in defines
Using tabs for column alignment makes the code easier to read.

No functional change intended.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
e5cd7dd9a4 hwmon: (amc6821) Reorder include files, drop unnecessary ones
Reorder include files to alphabetic order to simplify maintenance,
and drop the unnecessary kernel.h include.

No functional change intended.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
becbd16ed2 hwmon: (amc6821) Add support for fan1_target and pwm1_enable mode 4
After setting fan1_target and setting pwm1_enable to 4,
the fan controller tries to achieve the requested fan speed.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
154a0c2bd6 hwmon: (amc6821) Rename fan1_div to fan1_pulses
The chip does not have a fan divisor. What it does have is a configuration
to set either 2 or 4 pulses per fan rotation. Rename the attribute to
reflect its use. Update documentation accordingly.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
8f4fd97df2 hwmon: (amc6821) Make reading and writing fan speed limits consistent
The default value of the maximum fan speed limit register is 0,
essentially translating to an unlimited fan speed. When reading
the limit, a value of 0 is reported in this case. However, writing
a value of 0 results in writing a value of 0xffff into the register,
which is inconsistent.

To solve the problem, permit writing a limit of 0 for the maximim fan
speed, effectively translating to "no limit". Write 0 into the register
if a limit value of 0 is written. Otherwise limit the range to
<1..6000000> and write 1..0xffff into the register. This ensures that
reading and writing from and to a limit register return the same value
while at the same time not changing reported values when reading the
speed or limits.

While at it, restrict fan limit writes to non-negative numbers; writing
a negative limit does not make sense and should be reported instead of
being corrected.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
af4d04b8ce hwmon: (amc6821) Stop accepting invalid pwm values
The pwm value range is well defined from 0..255. Don't accept any values
outside this range.

This changes the valid range of pwm1_auto_point2_pwm from 0..254 to 0..255,
meaning it can now be equivalent to not only pwm1_auto_point1_pwm (which is
always 0) but also to pwm1_auto_point3_pwm (which is always 255). While
that may not be practical, there seems to be no technical reason for
preventing a user from doing it.

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-08 07:52:36 -07:00
Guenter Roeck
5c1de37969 hwmon: (w83627ehf) Fix underflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtol() results in an underflow if a large
negative number such as -9223372036854775808 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-07 07:48:25 -07:00
Guenter Roeck
0403e10bf0 hwmon: (nct6775-core) Fix underflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtol() results in an underflow if a large
negative number such as -9223372036854775808 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-07 07:48:25 -07:00
Guenter Roeck
af64e3e153 hwmon: (lm95234) Fix underflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtol() results in an underflow if a large
negative number such as -9223372036854775808 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-07 07:48:25 -07:00
Guenter Roeck
8cad724c85 hwmon: (adc128d818) Fix underflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtol() results in an underflow if a large
negative number such as -9223372036854775808 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-07 07:48:25 -07:00
Javier Carrasco
0811b8b03b hwmon: (gsc-hwmon) constify read-only struct regmap_bus
`gsc_hwmon_regmap_bus` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240705-hwmon-const-regmap-v1-1-7cde543ba818@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-05 14:37:01 -07:00
Dan Carpenter
99bf7c2ecc hwmon: (ltc2991) re-order conditions to fix off by one bug
LTC2991_T_INT_CH_NR is 4.  The st->temp_en[] array has LTC2991_MAX_CHANNEL
(4) elements.  Thus if "channel" is equal to LTC2991_T_INT_CH_NR then we
have read one element beyond the end of the array.  Flip the conditions
around so that we check if "channel" is valid before using it as an array
index.

Fixes: 2b9ea4262a ("hwmon: Add driver for ltc2991")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/Zoa9Y_UMY4_ROfhF@stanley.mountain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-04 18:14:50 -07:00
Greg Kroah-Hartman
14c4dc8bb6 IIO: 2nd set of new device support, features and cleanup for 6.11
The big one here is we finally have Paul Cercueil's (and others)
 DMA buffer support for IIO devices enabling high speed zero
 copy transfer of data to and from sensors supported by IIO (and for
 example USB).  This should aid with upstream support of a range of
 higher performance ADCs and DACs.
 
 Two merges from other trees
 - spi/spi_devm_optimize used for simplification in ad7944.
 - dmaengine/topic_dma_vec to enable the DMABUF series.
 
 One feature with impact outside IIO.
 - Richer set of dev_err_probe() like helpers to cover ERR_PTR() cases.
 
 New device support
 ==================
 adi,ad7173
 - Add support for AD4111, AD4112, AD4114, AD4115 and ADC4116 pseudo
   differential ADCs. Major driver rework was needed to enabled these.
 adi,ad7944
 - Use devm_spi_optimize_message() to avoid a local devm cleanup
   callback. This is the example case from the patch set, others will
   follow.
 mediatek,mt6359-auxadc
 - New driver for this ADC IP found in MT6357, MT6358 and MT6359 PMICs.
 st,accel
 - Add support for the LIS2DS12 accelerometer
 ti,ads1119
 - New driver for this 16 bit 2-differential or 4-single ended channel
   ADC.
 
 Features
 ========
 dt-bindings
 - Introduce new common-mode-channel property to help handle pseudo
   differential ADCs where we have something that looks like one side
   of differential input, but which is only suited for use with a
   slow moving reference.
 adi,adf4350
 - Support use as a clock provider.
 iio-hmwon
 - Support reading of labels from IIO devices by their consumers and
   use this in the hwmon bridge.
 
 Cleanup and minor fixes
 =======================
 Treewide
 - Use regmap_clear_bits() / regmap_set_bits() to simplify open coded
   equivalents.
 - Use devm_regulator_get_enable_read_voltage() to replace equivalent
   opencoded boilerplate. In some cases enabled complete conversion to
   devm handling and removal of explicit remove() callbacks.
 - Introduce dev_err_ptr_probe() and other variants and make use of
   of them in a couple of examples driver cleanups. Will find use in
   many more drivers soon.
 adi,ad7192
 - Introduce local struct device *dev and use dev_err_probe() to give
   more readable code.
 adi,adi-axi-adc/dac
 - Improved consistency of messages using dev_err_probe()
 adi,adis
 - Split the trigger handling into cases that needed paging and those that
   don't resulting in more readable code.
 - Use cleanup.h to simplify error paths via scoped cleanup.
 - Add adis specific lock helpers and make use of them in a number of drivers.
 adi,ad7192
 - Update maintainer (Alisa-Dariana Roman)
 adi,ad7606
 - dt-binding cleanup.
 avago,apds9306
 - Add a maintainer entry (Subhajit Ghosh)
 linear,ltc2309
 - Fix a wrong endian type.
 st,stm32-dfsdm
 - Fix a missing port property in the dt-binding.
 st,sensors
 - Relax whoami match failure to a warning print rather than probe failure.
   This enables fallback compatibles to existing parts from those that don't
   necessarily even exit yet.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmaEXkQRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FojAVBAAnaPB1CCyh61JkMQx815wn87looa+JRi3
 v8J/NsM64gYEwG6aNLLxrHAMFECw4GVrL4rHA5bCJFlSYioSKgs0VB7ltOJ/2258
 CsnSxgJ+4fN0468oZz63WuvrmxBsLGbPRGdE/6pkLMJiGHC0Bb/v3ngrJ/LUbAt6
 j0zAFZ2lb5+iuM8MW5vUE0AcwoQakZEg75N4jD6vHSiLvk6dAduj+R8k6z4OlER9
 MaotfjIqYieQ/4SplMcJEd63IxodKjBJacZHFu7uN8d7VWkDhNPyPrJ388GoeXP6
 CK1cTQWO7ZD2yCdY5LjXJYCAejgtiCIMtM7ghe0ZU/OuDBOFgmoaHrmi48pceF9o
 h8KeOsZIa9oF8SSZuKROTQWAwh33F6elf+IoUWYp61hJwft1BQF060rTsGfm7Qq5
 bFOPwMn+BJASC3ARtjNAI/posdAyS4Tb7fBBsDZ9bMW1Y02X/jlhDvDby1WNAcSY
 LEttjsA/naCfquXy4ng+T9sNB+sy2x92FwgEv1Z9MrnMKp5T+mX6XWQ/xhHplGGa
 VAohB/31EatglJqPS0U9mLr1cmUsBS7ItHG9bDB5mOE9wQA5yAqhEqTbe2P3sWWO
 OW43UVaS1VTd10XbY3l0Jjpwe3qsMZNt6M+JaCSizUCLQiEc0h06THcB/xgxdbad
 sTmopNgIR3Y=
 =+9tp
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-6.11b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

IIO: 2nd set of new device support, features and cleanup for 6.11

The big one here is we finally have Paul Cercueil's (and others)
DMA buffer support for IIO devices enabling high speed zero
copy transfer of data to and from sensors supported by IIO (and for
example USB).  This should aid with upstream support of a range of
higher performance ADCs and DACs.

Two merges from other trees
- spi/spi_devm_optimize used for simplification in ad7944.
- dmaengine/topic_dma_vec to enable the DMABUF series.

One feature with impact outside IIO.
- Richer set of dev_err_probe() like helpers to cover ERR_PTR() cases.

New device support
==================
adi,ad7173
- Add support for AD4111, AD4112, AD4114, AD4115 and ADC4116 pseudo
  differential ADCs. Major driver rework was needed to enabled these.
adi,ad7944
- Use devm_spi_optimize_message() to avoid a local devm cleanup
  callback. This is the example case from the patch set, others will
  follow.
mediatek,mt6359-auxadc
- New driver for this ADC IP found in MT6357, MT6358 and MT6359 PMICs.
st,accel
- Add support for the LIS2DS12 accelerometer
ti,ads1119
- New driver for this 16 bit 2-differential or 4-single ended channel
  ADC.

Features
========
dt-bindings
- Introduce new common-mode-channel property to help handle pseudo
  differential ADCs where we have something that looks like one side
  of differential input, but which is only suited for use with a
  slow moving reference.
adi,adf4350
- Support use as a clock provider.
iio-hmwon
- Support reading of labels from IIO devices by their consumers and
  use this in the hwmon bridge.

Cleanup and minor fixes
=======================
Treewide
- Use regmap_clear_bits() / regmap_set_bits() to simplify open coded
  equivalents.
- Use devm_regulator_get_enable_read_voltage() to replace equivalent
  opencoded boilerplate. In some cases enabled complete conversion to
  devm handling and removal of explicit remove() callbacks.
- Introduce dev_err_ptr_probe() and other variants and make use of
  of them in a couple of examples driver cleanups. Will find use in
  many more drivers soon.
adi,ad7192
- Introduce local struct device *dev and use dev_err_probe() to give
  more readable code.
adi,adi-axi-adc/dac
- Improved consistency of messages using dev_err_probe()
adi,adis
- Split the trigger handling into cases that needed paging and those that
  don't resulting in more readable code.
- Use cleanup.h to simplify error paths via scoped cleanup.
- Add adis specific lock helpers and make use of them in a number of drivers.
adi,ad7192
- Update maintainer (Alisa-Dariana Roman)
adi,ad7606
- dt-binding cleanup.
avago,apds9306
- Add a maintainer entry (Subhajit Ghosh)
linear,ltc2309
- Fix a wrong endian type.
st,stm32-dfsdm
- Fix a missing port property in the dt-binding.
st,sensors
- Relax whoami match failure to a warning print rather than probe failure.
  This enables fallback compatibles to existing parts from those that don't
  necessarily even exit yet.

* tag 'iio-for-6.11b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (112 commits)
  iio: adc: ad7173: Fix uninitialized symbol is_current_chan
  iio: adc: Add support for MediaTek MT6357/8/9 Auxiliary ADC
  math.h: Add unsigned 8 bits fractional numbers type
  dt-bindings: iio: adc: Add MediaTek MT6359 PMIC AUXADC
  iio: common: scmi_iio: convert to dev_err_probe()
  iio: backend: make use of dev_err_cast_probe()
  iio: temperature: ltc2983: convert to dev_err_probe()
  dev_printk: add new dev_err_probe() helpers
  iio: xilinx-ams: Add labels
  iio: adc: ad7944: use devm_spi_optimize_message()
  Documentation: iio: Document high-speed DMABUF based API
  iio: buffer-dmaengine: Support new DMABUF based userspace API
  iio: buffer-dma: Enable support for DMABUFs
  iio: core: Add new DMABUF interface infrastructure
  MAINTAINERS: Update AD7192 driver maintainer
  iio: adc: ad7192: use devm_regulator_get_enable_read_voltage
  iio: st_sensors: relax WhoAmI check in st_sensors_verify_id()
  MAINTAINERS: Add AVAGO APDS9306
  dt-bindings: iio: adc: adi,ad7606: comment and sort the compatible names
  dt-bindings: iio: adc: adi,ad7606: add missing datasheet link
  ...
2024-07-04 11:04:20 +02:00
Alex Vdovydchenko
cd228e7b65 hwmon: add MP5920 driver
Add support for MPS Hot-Swap controller mp5920. This driver exposes
telemetry and limit value readings and writings.

Signed-off-by: Alex Vdovydchenko <xzeol@yahoo.com>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20240702115252.981416-3-xzeol@yahoo.com
[groeck: Use min_t() to limit length of displayed model string]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-02 12:36:31 -07:00
Javier Carrasco
f642714b78 hwmon: (tps23861) Constify struct regmap_config
`tps23861_regmap_config` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240702-hwmon-const-regmap-v1-3-63f6d4765fe0@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-02 11:31:30 -07:00
Javier Carrasco
4bc82dd20b hwmon: (tmp513) Constify struct regmap_config
`tmp51x_regmap_config` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240702-hwmon-const-regmap-v1-2-63f6d4765fe0@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-02 11:31:02 -07:00
Javier Carrasco
9d047eb05c hwmon: (ina238) Constify struct regmap_config
`ina238_regmap_config` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240702-hwmon-const-regmap-v1-1-63f6d4765fe0@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-02 11:30:10 -07:00
Wayne Tung
39b24cced7 hwmon: (adt7475) Fix default duty on fan is disabled
According to the comments on fan is disabled, we change to manual mode
and set the duty cycle to 0.
For setting the duty cycle part, the register is wrong. Fix it.

Fixes: 1c301fc539 ("hwmon: Add a driver for the ADT7475 hardware monitoring chip")
Signed-off-by: Wayne Tung <chineweff@gmail.com>
Link: https://lore.kernel.org/r/20240701073252.317397-1-chineweff@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-07-01 15:45:57 -07:00
Guenter Roeck
b3e992f69c hwmon: (jc42) Strengthen detect function
Configuration register bit 5 must read 0 for all JC42.4 compliant chips.
Several capability register bits must be set for all TSE2004 compliant
chips. Use that information to strengthen the detect function.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-30 13:15:26 -07:00
Guenter Roeck
c98cf41dfb hwmon: (jc42) Use common device ID for TSE2004av compliant sensors
TSE2004av standardizes the device ID of compliant temperature sensors to
be 0x22xx, where xx is the device revision. Use a single define for all
TSE2004av compliant temperature sensors, and relax the device id mask to
match the upper 8 bit of the device id register.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-30 13:15:23 -07:00
Armin Wolf
ef8df816ee hwmon: (dell-smm) Add Dell OptiPlex 7060 to DMI table
The BIOS on this machine is buggy and will in some cases return
an error when trying to get the fan state, but reading of the
RPM values and the temperature sensors still works.

Closes: https://github.com/vitorafsr/i8kutils/issues/38
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Acked-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20240628214723.19665-1-W_Armin@gmx.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-30 09:13:08 -07:00
Sean Anderson
440db4075f hwmon: iio: Add labels from IIO channels
Add labels from IIO channels to our channels. This allows userspace to
display more meaningful names instead of "in0" or "temp5".

Although lm-sensors gracefully handles errors when reading channel
labels, the ABI says the label attribute

> Should only be created if the driver has hints about what this voltage
> channel is being used for, and user-space doesn't.

Therefore, we test to see if the channel has a label before
creating the attribute.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://patch.msgid.link/20240624174601.1527244-3-sean.anderson@linux.dev
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-06-28 20:07:18 +01:00
Noah Wang
38b2b02236 hwmon: add MP2891 driver
Add support for MPS VR controller mp2891. This driver exposes
telemetry and limit value readings and writtings.

Signed-off-by: Noah Wang <noahwang.wang@outlook.com>
Link: https://lore.kernel.org/r/SEYPR04MB64828A352836982C0184AA10FAD62@SEYPR04MB6482.apcprd04.prod.outlook.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-28 10:27:47 -07:00
Sean Anderson
52c1e818d6 hwmon: iio: Use iio_read_channel_processed_scale for IIO_POWER
Instead of rescaling power channels after the fact, use the dedicated
scaling API. This should reduce any inaccuracies resulting from the
scaling.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Link: https://lore.kernel.org/r/20240620212005.821805-1-sean.anderson@linux.dev
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-21 08:09:32 -07:00
Guenter Roeck
1226a1b2e5 hwmon: (spd5118) Add support for Renesas/ITD SPD5118 hub controllers
The SPD5118 specification says, in its documentation of the page bits
in the MR11 register:

"
This register only applies to non-volatile memory (1024) Bytes) access of
SPD5 Hub device.
For volatile memory access, this register must be programmed to '000'.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"

Renesas/ITD SPD5118 hub controllers take this literally and disable access
to volatile memory if the page selected in MR11 is != 0. Since the BIOS or
ROMMON will access the non-volatile memory and likely select a page != 0,
this means that the driver will not instantiate since it can not identify
the chip. Even if the driver instantiates, access to volatile registers
is blocked after a nvram read operation which selects a page other than 0.

To solve the problem, add initialization code to select page 0 during
probe. Before doing that, use basic validation to ensure that this is
really a SPD5118 device and not some random EEPROM.

Cc: Sasha Kozachuk <skozachuk@google.com>
Cc: John Hamrick <johnham@google.com>
Cc: Chris Sarra <chrissarra@google.com>
Tested-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-18 20:07:42 -07:00
Guenter Roeck
27972a4142 hwmon: (spd5118) Use regmap to implement paging
Using regmap for paging significantly improves caching since the regmap
cache no longer needs to be cleared after changing the page, so let's
use it.

Suggested-by: Armin Wolf <W_Armin@gmx.de>
Tested-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-18 20:07:42 -07:00
Tony Luck
a43b9ec091 peci, hwmon: Switch to new Intel CPU model defines
Update peci subsystem to use the same vendor-family-model
combined definition that core x86 code uses.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com>
Link: https://lore.kernel.org/r/20240529171920.62571-1-tony.luck@intel.com
Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
2024-06-17 15:15:46 +02:00
Naresh Solanki
842b4d98ae hwmon: (max6639) : Add additional hwmon attributes for fan and pwm
Add additional attributes for fan & pwm i.e.,
fanY_pulses
pwmY_freq

Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com>
Link: https://lore.kernel.org/r/20240614055533.2735210-2-naresh.solanki@9elements.com
[groeck: Fix value range for fanX_pulses]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-14 06:37:06 -07:00
Naresh Solanki
0f33272b60 hwmon: (max6639) : Update hwmon init using info structure
Update hwmon init with info instead of group. The hwmon info structure
in more flexible to describe sensor attribute & easy to maintian.

Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com>
Link: https://lore.kernel.org/r/20240614055533.2735210-1-naresh.solanki@9elements.com
[groeck: Replace clamp_val() with range check when writing pwmX_input]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-14 06:36:12 -07:00
Thomas Weißschuh
52115fc329 hwmon: (core) Make hwmon_class const
Now that the driver core allows for struct class to be in read-only
memory, mark hwmon_class as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20240614-class-const-hwmon-v1-1-27b910d06a90@weissschuh.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-13 16:44:34 -07:00
Noah Wang
dc5abc2ff0 hwmon: add MP9941 driver
Add support for MPS step-down converter mp9941. This driver exposes
telemetry and limit value readings and writtings.

Signed-off-by: Noah Wang <noahwang.wang@outlook.com>
Link: https://lore.kernel.org/r/SEYPR04MB648294005D55F70736B519F6FAC72@SEYPR04MB6482.apcprd04.prod.outlook.com
[groeck: Include bitfield.h (for FIELD_PREP) and bits.h (for GENMASK)]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-12 22:39:34 -07:00
Noah Wang
fc37348c90 hwmon: add MP2993 driver
Add support for MPS VR controller mp2993. This driver exposes
telemetry and limits value readings and writtings.

Signed-off-by: Noah Wang <noahwang.wang@outlook.com>
Link: https://lore.kernel.org/r/SEYPR04MB648203DC017A514837DB1204FAC72@SEYPR04MB6482.apcprd04.prod.outlook.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-12 08:59:44 -07:00
Amna Waseem
ec5d234f19 hwmon: (ina2xx) Add device tree support to pass alert polarity
The INA230 has an Alert pin which is asserted when the alert
function selected in the Mask/Enable register exceeds the
value programmed into the Alert Limit register. Assertion is based
on the Alert Polarity Bit (APOL, bit 1 of the Mask/Enable register).
It is default set to value 0 i.e Normal (active-low open collector).
However, hardware can be designed in such a way that expects Alert pin
to become active high if a user-defined threshold in Alert limit
register has been exceeded. This patch adds a way to pass alert polarity
value to the driver via device tree.

Signed-off-by: Amna Waseem <Amna.Waseem@axis.com>
Link: https://lore.kernel.org/r/20240611-apol-ina2xx-fix-v4-2-8df1d2282fc5@axis.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-12 07:15:09 -07:00
Yazen Ghannam
efdf761a83 hwmon: (k10temp) Rename _data variable
...to address the following warning:

  drivers/hwmon/k10temp.c:273:47:
  warning: declaration shadows a variable in the global scope [-Wshadow]
  static umode_t k10temp_is_visible(const void *_data,
                                              ^
No functional change is intended.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240606-fix-smn-bad-read-v4-8-ffde21931c3f@amd.com
2024-06-12 11:40:31 +02:00
Yazen Ghannam
0e097f2b59 hwmon: (k10temp) Remove unused HAVE_TDIE() macro
...to address the following warning:

  drivers/hwmon/k10temp.c:104:9:
  warning: macro is not used [-Wunused-macros]

No functional change is intended.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240606-fix-smn-bad-read-v4-7-ffde21931c3f@amd.com
2024-06-12 11:40:17 +02:00
Yazen Ghannam
a8bc4165d2 hwmon: (k10temp) Reduce k10temp_get_ccd_support() parameters
Currently, k10temp_get_ccd_support() takes as input "pdev" and "data".  However,
"pdev" is already included in "data". Furthermore, the "pdev" parameter is no
longer used in k10temp_get_ccd_support(), since its use was moved into
read_ccd_temp_reg().

Drop the "pdev" input parameter as it is no longer needed.

No functional change is intended.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240606-fix-smn-bad-read-v4-6-ffde21931c3f@amd.com
2024-06-12 11:39:49 +02:00
Yazen Ghannam
cc66126fd3 hwmon: (k10temp) Define a helper function to read CCD temperature
The CCD temperature register is read in two places. These reads are done
using an AMD SMN access, and a number of parameters are needed for the
operation.

Move the SMN access and parameter gathering into a helper function in order to
simplify the code flow. This also has a benefit of centralizing the hardware
register access in a single place in case fixes or special decoding is required.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240606-fix-smn-bad-read-v4-5-ffde21931c3f@amd.com
2024-06-12 11:39:29 +02:00
Yazen Ghannam
c2d79cc545 hwmon: (k10temp) Check return value of amd_smn_read()
Check the return value of amd_smn_read() before saving a value. This
ensures invalid values aren't saved or used.

There are three cases here with slightly different behavior:

1) read_tempreg_nb_zen():
	This is a function pointer which does not include a return code.
	In this case, set the register value to 0 on failure. This
	enforces Read-as-Zero behavior.

2) k10temp_read_temp():
	This function does have return codes, so return the error code
	from the failed register read. Continued operation is not
	necessary, since there is no valid data from the register.
	Furthermore, if the register value was set to 0, then the
	following operation would underflow.

3) k10temp_get_ccd_support():
	This function reads the same register from multiple CCD
	instances in a loop. And a bitmask is formed if a specific bit
	is set in each register instance. The loop should continue on a
	failed register read, skipping the bit check.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240606-fix-smn-bad-read-v4-3-ffde21931c3f@amd.com
2024-06-12 11:33:46 +02:00
Guenter Roeck
cbbb76e4b8 hwmon: (pmbus/lm25066) Let enum chips start with index 0
Commit ac0c26bae6 ("hwmon: (lm25066) Use i2c_get_match_data()") changed
enum chips to start with 1 instead of 0, under the assumption that
the data pointer in of_device_id must not start with 0 (NULL) if
i2c_get_match_data() is used. However, that is perfectly fine as long as
there is also an i2c_device_id array with the same data which is used
as fallback in that case.

Let enum chips start with 0 to avoid confusion against other drivers
where the enum starts with 0 and i2c_get_match_data() is used as well.

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-11 07:25:13 -07:00
Guenter Roeck
2255893444 hwmon: (nct6775) Let enum kinds start with index 0
Commit 10a0575ea0 ("hwmon: (nct6775-i2c) Use i2c_get_match_data()")
introduced calling i2c_get_match_data() to the nct6775 driver. As part
of that commit, enum kinds was changed to start with 1, based on

    Adjust the 'kinds' enum to not use 0, so that no match data can be
    distinguished from a valid enum value.

The patch had to be fixed later with commit 2792fc8f8c ("hwmon:
(nct6775-core) Explicitly initialize nct6775_device_names indexes") and
commit efe86092ab ("hwmon: (nct6775-platform) Explicitly initialize
nct6775_sio_names indexes").

Various patches submitted later show that the change from 0 to 1 is
not really necessary. As it turns out, it is perfectly fine as long as
there is an i2c_device_id array with the same data as in the of_device_id
array. This data is used as fallback if the data pointer in struct
of_device_id is NULL (0).

Let enum chips start with 0 to avoid confusion against other drivers
where the enum starts with 0 and i2c_get_match_data() is used as well.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-11 07:25:13 -07:00
Guenter Roeck
e229c6e80f hwmon: (pmbus/mp2856) Let enum chips start with index 0
Earlier it was assumed that the data pointer in of_device_id must not start
with 0 (NULL) if i2c_get_match_data() is used. However, it turns out that
this is perfectly fine as long as there is also an i2c_device_id array with
the same data, which is used as fallback in that case.

Let enum chips start with 0 to avoid confusion against other drivers
where the enum starts with 0 and i2c_get_match_data() is used as well.

While doing that, remove chip_id from struct mp2856_data since it is only
used in the probe function, and typecast the result of i2c_get_match_data()
to kernel_ulong_t to avoid the double typecast.

Cc: Peter Yin <peteryin.openbmc@gmail.com>
Cc: Potin Lai <potin.lai.pt@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-11 07:25:13 -07:00
Guenter Roeck
138d45d967 hwmon: (pmbus/max31827) Explain why enum chips must not start with 0
If a driver calls device_get_match_data(), the .data pointer in its id
data structures must not be NULL/0 because device_get_match_data()
returns NULL if an entry is not found. Explain that in a comment to avoid
confusion why this is required in this driver but not in other drivers.

Cc: Daniel Matyas <daniel.matyas@analog.com>
Acked-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-11 07:25:03 -07:00
Eugene Shalygin
71ac69e089 hwmon: (asus-ec-sensors) add ProArt X670E-CREATOR WIFI
Provided and tested by a user in a GitHub PR [1].

[1] https://github.com/zeule/asus-ec-sensors/pull/56

Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com>
Link: https://lore.kernel.org/r/20240608085146.572777-2-eugene.shalygin@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-10 09:13:56 -07:00
Guenter Roeck
9ecc129470 hwmon: (spd5118) Add configuration option for auto-detection
With SPD5118 chip detection for the most part handled by the i2c-smbus
core using DMI information, the spd5118 driver no longer needs to
auto-detect spd5118 compliant chips.

Auto-detection by the driver is still needed on systems with no DMI support
or on systems with more than eight DIMMs and can not be removed entirely.
However, it affects boot time and introduces the risk of mis-identifying
chips. Add configuration option to be able to disable it on systems where
chip detection is handled outside the driver.

Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Tested-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-10 09:13:41 -07:00
Guenter Roeck
25dff444c6 hwmon: (spd5118) Add support for reading SPD data
Add support for reading SPD NVMEM data from SPD5118 (Jedec JESD300)
compliant memory modules. NVMEM write operation is not supported.

NVMEM support is optional. If CONFIG_NVMEM is disabled, the driver will
still instantiate but not provide NVMEM attribute files.

Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Tested-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-10 09:13:41 -07:00
Guenter Roeck
d1b4c75508 hwmon: (spd5118) Add suspend/resume support
Add suspend/resume support to ensure that limit and configuration
registers are updated and synchronized after a suspend/resume cycle.

Cc: Armin Wolf <W_Armin@gmx.de>
Cc: Stephen Horvath <s.horvath@outlook.com.au>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Tested-by: Stephen Horvath <s.horvath@outlook.com.au>
Tested-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-10 09:13:41 -07:00
Guenter Roeck
09262e9814 hwmon: Add support for SPD5118 compliant temperature sensors
Add support for SPD5118 (Jedec JESD300) compliant temperature
sensors. Such sensors are typically found on DDR5 memory modules.

Cc: René Rebe <rene@exactcode.de>
Cc: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Tested-by: Thomas Weißschuh <linux@weissschuh.net>
Tested-by: Stephen Horvath <s.horvath@outlook.com.au>
Tested-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-10 09:13:41 -07:00
Jeff Johnson
fb7a4931ef hwmon: add missing MODULE_DESCRIPTION() macros
make allmodconfig && make W=1 C=1 reports:
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hwmon/asus_atk0110.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hwmon/corsair-cpro.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hwmon/mr75203.o

Add all missing invocations of the MODULE_DESCRIPTION() macro.

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20240607-md-drivers-hwmon-v1-1-1ea6d6fe61e3@quicinc.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Javier Carrasco
1ee1237941 hwmon: (gsc-hwmon) use device_for_each_child_node_scoped()
Switch to the _scoped() version introduced in commit 365130fd47
("device property: Introduce device_for_each_child_node_scoped()")
to remove the need for manual calling of fwnode_handle_put() in the
paths where the code exits the loop early.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240404-hwmon_device_for_each_child_node_scoped-v1-2-53997abde43c@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Javier Carrasco
234c07400e hwmon: (ltc2991) use device_for_each_child_node_scoped()
Switch to the _scoped() version introduced in commit 365130fd47
("device property: Introduce device_for_each_child_node_scoped()")
to remove the need for manual calling of fwnode_handle_put() in the
paths where the code exits the loop early.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240404-hwmon_device_for_each_child_node_scoped-v1-1-53997abde43c@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
55076454de hwmon: (w83795): Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-32-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
00dcf379ff hwmon: (w83781d) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-31-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
38a085f9f4 hwmon: (tmp464) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-30-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
8b6e514c59 hwmon: (tmp421) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-29-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
516d5765a3 hwmon: (tmp401) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-28-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
50ba2d3d48 hwmon: (thmc50) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-27-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
64306a4719 hwmon: (shtc1) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-26-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
f147dbd7ea hwmon: (sht3x) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-25-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
77944b479d hwmon: (powr1220) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-24-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
f1230f756a hwmon: (mcp3021) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-23-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
de5fb06ca7 hwmon: (max6697) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-22-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
495e6a9cf5 hwmon: (max1668) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-21-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
5a71654b39 hwmon: (max16065) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-20-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
e2791bdfa6 hwmon: (lm95234) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-19-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
711e2e4f69 hwmon: (lm90) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-18-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
4cfd3ceeaa hwmon: (lm85) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-17-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
9339bed921 hwmon: (lm83) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-16-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
e49d1a1d33 hwmon: (lm78) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-15-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:33 -07:00
Andrew Davis
5178911d5c hwmon: (lm75) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-14-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
cbc9b40818 hwmon: (lm63) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-13-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
8b83969903 hwmon: (ina2xx) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-12-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
945e71d5aa hwmon: (fschmd) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-11-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
72fdab6b40 hwmon: (f75375s) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-10-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
698d692cd8 hwmon: (ds1621) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-9-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
9072777d93 hwmon: (dme1737) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-8-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
941421c9ea hwmon: (aht10) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-7-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
732d2624cf hwmon: (adt7475) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-6-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
ec67556307 hwmon: (ads7828) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-5-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
0f1874f847 hwmon: (adm1031) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-4-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
884369b2c9 hwmon: (adm1021) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-3-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Andrew Davis
244f1664fe hwmon: (ad7418) Remove use of i2c_match_id()
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240403203633.914389-2-afd@ti.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Krzysztof Kozlowski
b1ea8f7a30 hwmon: lm70: simplify with spi_get_device_match_data()
Use spi_get_device_match_data() helper to simplify a bit the driver.
Also kernel_ulong_t type is preferred for kernel code over uintptr_t
(needed for the cast).

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240606142515.132504-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-08 16:07:32 -07:00
Guenter Roeck
c8a4bdca92 hwmon: (cros_ec) Fix access to restricted __le16
0-day complains:

drivers-hwmon-cros_ec_hwmon.c:sparse:sparse:cast-to-restricted-__le16

Fix by using a __le16 typed variable as parameter to le16_to_cpu().

Fixes: bc3e452580 ("hwmon: add ChromeOS EC driver")
Cc: Thomas Weißschuh <linux@weissschuh.net>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20240606180507.3332237-1-linux@roeck-us.net
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
2024-06-07 09:59:58 +00:00
Dan Carpenter
1f72dd0462 hwmon: (cros_ec) Prevent read overflow in probe()
The "resp.sensor_name" comes from cros_ec_cmd() and it hasn't necessarily
been NUL terminated.  We had not intended to read past "sensor_name_size"
bytes, however, there is a width vs precision bug in the format string.
The format needs to be precision '%.*s' instead of width '%*s'.
Precision prevents an out of bounds read, but width is a no-op.

Fixes: bc3e452580 ("hwmon: add ChromeOS EC driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/42331b70-bd3c-496c-8c79-3ec4faad40b8@moroto.mountain
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
2024-06-07 09:57:44 +00:00
Christian Marangi
6ce402327a hwmon: g672: add support for g761
Add support for g761 PWM Fan Controller.

The g761 is a copy of the g763 with the only difference of supporting
and internal clock. The internal clock is used if no clocks property is
defined in device node and in such case the required bit is enabled and
clock handling is skipped.

The internal clock oscillator runs at 31KHz.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://lore.kernel.org/r/20240604164348.542-3-ansuelsmth@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-04 09:58:32 -07:00
Radu Sabau
5124d9acf3 hwmon: (max31827) Add PEC support
Add PEC support using the hwmon core infrastructure.

Signed-off-by: Radu Sabau <radu.sabau@analog.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240531084645.12935-2-radu.sabau@analog.com
[groeck: Adjusted subject; simplified description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-03 20:26:31 -07:00
Guenter Roeck
fcbb583f33 hwmon: (lm90) Convert to use PEC support from hwmon core
Replace driver specific PEC handling code with hardware monitoring core
functionality.

Cc: Radu Sabau <radu.sabau@analog.com>
Acked-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-03 20:26:31 -07:00
Guenter Roeck
4ce6e8a859 hwmon: Add PEC attribute support to hardware monitoring core
Several hardware monitoring chips optionally support Packet Error Checking
(PEC). For some chips, PEC support can be enabled simply by setting
I2C_CLIENT_PEC in the i2c client data structure. Others require chip
specific code to enable or disable PEC support.

Introduce hwmon_chip_pec and HWMON_C_PEC to simplify adding configurable
PEC support for hardware monitoring drivers. A driver can set HWMON_C_PEC
in its chip information data to indicate PEC support. If a chip requires
chip specific code to enable or disable PEC support, the driver only needs
to implement support for the hwmon_chip_pec attribute to its write
function.

Packet Error Checking is only supported for SMBus devices. HWMON_C_PEC
must therefore only be set by a driver if the parent device is an I2C
device. Attempts to set HWMON_C_PEC on any other device type is not
supported and rejected.

The code calls i2c_check_functionality() to check if PEC is supported
by the I2C/SMBus controller. This function is only available if CONFIG_I2C
is enabled and reachable. For this reason, the added code needs to depend
on reachability of CONFIG_I2C.

Cc: Radu Sabau <radu.sabau@analog.com>
Acked-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-06-03 20:25:28 -07:00
Thomas Weißschuh
bc3e452580 hwmon: add ChromeOS EC driver
The ChromeOS Embedded Controller exposes fan speed and temperature
readings.
Expose this data through the hwmon subsystem.

The driver is designed to be probed via the cros_ec mfd device.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240529-cros_ec-hwmon-v4-2-5cdf0c5db50a@weissschuh.net
[tzungbi: Fixed typo in MAINTAINERS: "chros_ec_hwmon" -> "cros_ec_hwmon"]
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
2024-06-03 04:13:43 +00:00
Guenter Roeck
52a2c70c3e hwmon: (shtc1) Fix property misspelling
The property name is "sensirion,low-precision", not
"sensicon,low-precision".

Cc: Chris Ruehl <chris.ruehl@gtsys.com.hk>
Fixes: be7373b60d ("hwmon: shtc1: add support for device tree bindings")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-30 09:05:19 -07:00
Peter Colberg
027a44fedd hwmon: (intel-m10-bmc-hwmon) Fix multiplier for N6000 board power sensor
The Intel N6000 BMC outputs the board power value in milliwatt, whereas
the hwmon sysfs interface must provide power values in microwatt.

Fixes: e1983220ae ("hwmon: intel-m10-bmc-hwmon: Add N6000 sensors")
Signed-off-by: Peter Colberg <peter.colberg@intel.com>
Reviewed-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
Link: https://lore.kernel.org/r/20240521181246.683833-1-peter.colberg@intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-30 09:05:06 -07:00
Aleksandr Mezin
246e6426a8 hwmon: (nzxt-smart2) Add support for another version of NZXT RGB & Fan Controller
Add support for NZXT RGB & Fan Controller with USB ID 1e71:2020.

Fan speed control reported to be working with existing userspace (hidraw)
software, so it should be compatible. Fan channel count is the same.
No known differences from already supported devices, at least regarding
fan speed control and initialization.

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
Link: https://lore.kernel.org/r/20240524004040.121044-1-mezin.alexander@gmail.com
[groeck: Adjusted subject and description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-29 15:55:35 -07:00
Javier Carrasco
a94ff8e50c hwmon: (ltc2992) Fix memory leak in ltc2992_parse_dt()
A new error path was added to the fwnode_for_each_available_node() loop
in ltc2992_parse_dt(), which leads to an early return that requires a
call to fwnode_handle_put() to avoid a memory leak in that case.

Add the missing fwnode_handle_put() in the error path from a zero value
shunt resistor.

Cc: stable@vger.kernel.org
Fixes: 10b0290204 ("hwmon: (ltc2992) Avoid division by zero")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240523-fwnode_for_each_available_child_node_scoped-v2-1-701f3a03f2fb@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-29 15:34:46 -07:00
Wilken Gottwalt
b9c15c96cc hwmon: corsair-psu: add USB id of HX1200i Series 2023 psu
Add the usb id of the HX1200i Series 2023. Update the documentation
accordingly. Also fix the version comments, there are no Series 2022
products. That are legacy or first version products going back many
many years.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/ZlAZs4u0dU7JxtDf@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-29 15:33:18 -07:00
Armin Wolf
fa0bc8f297 hwmon: (dell-smm) Add Dell G15 5511 to fan control whitelist
A user reported that he needs to disable BIOS fan control on his
Dell G15 5511 in order to be able to control the fans.

Closes: https://github.com/Wer-Wolf/i8kutils/issues/5
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Acked-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20240522210809.294488-1-W_Armin@gmx.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-29 15:31:12 -07:00
Guenter Roeck
be7d9294a4 hwmon: (nct6683) Display warning when enabling driver for unknown customer
Enabling the driver for devices with unknown customer ID is at least
somewhat risky, so add a warning to the kernel log.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-29 15:23:54 -07:00
Marius Zachmann
5997eb60f8 hwmon: (corsair-cpro) Add firmware and bootloader information
Add support for reporting firmware and bootloader version using debugfs.
Update documentation accordingly.

Signed-off-by: Marius Zachmann <mail@mariuszachmann.de>
Link: https://lore.kernel.org/r/20240513194734.43040-2-mail@mariuszachmann.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-29 15:23:54 -07:00
Linus Torvalds
d90be6e4aa Driver core changes for 6.10-rc1
Here is the small set of driver core and kernfs changes for 6.10-rc1.
 
 Nothing major here at all, just a small set of changes for some driver
 core apis, and minor fixups.  Included in here are:
   - sysfs_bin_attr_simple_read() helper added and used
   - device_show_string() helper added and used
 All usages of these were acked by the various maintainers.  Also in here
 are:
   - kernfs minor cleanup
   - removed unused functions
   - typo fix in documentation
   - pay attention to sysfs_create_link() failures in module.c finally.
 
 All of these have been in linux-next for a very long time with no
 reported problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZk3+hQ8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ylfTwCfUyHWkDZuZ7ehdtjzfmcd4EKZBK8An3AAV99G
 ox8PXMxuFTaUEdT/69FQ
 =2sEo
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here is the small set of driver core and kernfs changes for 6.10-rc1.

  Nothing major here at all, just a small set of changes for some driver
  core apis, and minor fixups. Included in here are:

   - sysfs_bin_attr_simple_read() helper added and used

   - device_show_string() helper added and used

  All usages of these were acked by the various maintainers. Also in
  here are:

   - kernfs minor cleanup

   - removed unused functions

   - typo fix in documentation

   - pay attention to sysfs_create_link() failures in module.c finally

  All of these have been in linux-next for a very long time with no
  reported problems"

* tag 'driver-core-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  device property: Fix a typo in the description of device_get_child_node_count()
  kernfs: mount: Remove unnecessary ‘NULL’ values from knparent
  scsi: Use device_show_string() helper for sysfs attributes
  platform/x86: Use device_show_string() helper for sysfs attributes
  perf: Use device_show_string() helper for sysfs attributes
  IB/qib: Use device_show_string() helper for sysfs attributes
  hwmon: Use device_show_string() helper for sysfs attributes
  driver core: Add device_show_string() helper for sysfs attributes
  treewide: Use sysfs_bin_attr_simple_read() helper
  sysfs: Add sysfs_bin_attr_simple_read() helper
  module: don't ignore sysfs_create_link() failures
  driver core: Remove unused platform_notify, platform_notify_remove
2024-05-22 12:13:40 -07:00
Linus Torvalds
9d81e2d5a9 pwm: Changes for v6.10-rc1
Apart for the normal updates for dt bindings, cleanups and support for
 new device variants to existing drivers this completes the conversion to
 pwmchip_alloc() which was started in the v6.9 development cycle.
 
 Using pwmchip_alloc() is a precondition to the character device support
 which allows easier and faster access to PWM devices. However there are
 some issues I want to clean up before including it in mainline, so this
 isn't contained here despite it was in next for some time.
 
 Thanks to Alexandre Mergnat, Binbin Zhou, Dmitry Rokosov, George Stark,
 Jerome Brunet and Varshini Rajendran for their contributions. Further
 thanks go to AngeloGioacchino Del Regno, Conor Dooley, David Lechner,
 Fabrice Gasnier, Florian Fainelli, Guenter Roeck, Gustavo A. R. Silva,
 Krzysztof Kozlowski and Rob Herring for valuable patch review.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmZBz1cACgkQj4D7WH0S
 /k4lXQf9HTSvbCz4x6PAxXPEe5trXlnUxGUsPa73mj2bVV8jpnJIy3vIrzZ0C2BG
 dV6Pfo4rLZYdjFQJW3CalfQShmDXwBWhAbQ7jupt3CdJsZC8Uoqt3R9hJA6A2sp+
 g8JkHZ3YateggLIUWWyOosanSGdzLKayOXtmjhHeywD+VTMAjHNglYlB8XjqzbnC
 ti4F4Q4pJjjvap9oT6sKPGH05J43Z8LDJ3zo/0oQfo1NV5pPfxcBs6GqzuWROaW9
 DHWovz/KV06oYfiHHmtgxQxC6HO1J4lUQTMoF2kjcRmVwqeZXPWn8l1mmpQynJ/P
 94bixYQUUT+V2B0snhgnzEJNN6vEvw==
 =JaHr
 -----END PGP SIGNATURE-----

Merge tag 'pwm/for-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux

Pull pwm updates from Uwe Kleine-König:
 "Apart for the normal updates for dt bindings, cleanups and support for
  new device variants to existing drivers this completes the conversion
  to pwmchip_alloc() which was started in the v6.9 development cycle.

  Using pwmchip_alloc() is a precondition to the character device
  support which allows easier and faster access to PWM devices. However
  there are some issues I want to clean up before including it in
  mainline, so this isn't contained here despite it was in next for some
  time.

  Thanks to Alexandre Mergnat, Binbin Zhou, Dmitry Rokosov, George
  Stark, Jerome Brunet and Varshini Rajendran for their contributions.
  Further thanks go to AngeloGioacchino Del Regno, Conor Dooley, David
  Lechner, Fabrice Gasnier, Florian Fainelli, Guenter Roeck, Gustavo A.
  R. Silva, Krzysztof Kozlowski and Rob Herring for valuable patch
  review"

* tag 'pwm/for-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: (34 commits)
  pwm: pca9685: Drop explicit initialization of struct i2c_device_id::driver_data to 0
  dt-bindings: pwm: snps,dw-apb-timers: Do not require pwm-cells twice
  dt-bindings: pwm: mediatek,pwm-disp: Do not require pwm-cells twice
  dt-bindings: pwm: mediatek,mt2712: Do not require pwm-cells twice
  dt-bindings: pwm: marvell,pxa: Do not require pwm-cells twice
  dt-bindings: pwm: google,cros-ec: Do not require pwm-cells twice
  dt-bindings: pwm: bcm2835: Do not require pwm-cells twice
  pwm: meson: Use mul_u64_u64_div_u64() for frequency calculating
  pwm: meson: Add check for error from clk_round_rate()
  pwm: meson: Drop unneeded check in .get_state()
  dt-bindings: pwm: mediatek,pwm-disp: add compatible for mt8365 SoC
  pwm: meson: Add generic compatible for meson8 to sm1
  pwm: bcm2835: Drop open coded variant of devm_clk_rate_exclusive_get()
  pwm: bcm2835: Introduce a local variable for &pdev->dev
  pwm: stm32: Calculate prescaler with a division instead of a loop
  pwm: stm32: Fix for settings using period > UINT32_MAX
  pwm: stm32: Improve precision of calculation in .apply()
  pwm: stm32: Add error messages in .probe()'s error paths
  pwm: Make pwmchip_[sg]et_drvdata() a wrapper around dev_set_drvdata()
  pwm: Don't check pointer for being non-NULL after use
  ...
2024-05-14 15:03:19 -07:00
Linus Torvalds
a8cc7eb996 hwmon updates for v6.10
* New drivers
 
   - Infineon XDP710
 
   - EC Chip driver for Lenovo ThinkStation motherboards
 
   - Analog Devices ADP1050
 
 * Improved support for existing drivers
 
   - emc1403: Convert to with_info API; Support for EMC1428 and EMC1438
 
   - nzxt-kraken3: Support for NZXT Kraken 2023
 
   - aquacomputer_d5next: Support for Octo flow sensors
 
   - pmbus/adm1275: Support for ADM1281
 
   - dell-smm: Supportt for Precision 7540 and G5 5505
 
 * Other notable cleanup
 
   - max6639: Use regmap
 
   - Remove unused structure fields from multiple drivers
 
   - Drop explicit initialization of struct i2c_device_id::driver_data to 0
 
   - Improve configuration mode handling in it87 driver
 
   - jc42: Drop support for I2C_CLASS_SPD
 
   - Various conversions to devicetree schema
 
   - Add HAS_IOPORT dependencies as needed
 
 * Minor fixes and improvements to max31790, coretemp, aspeed-g6-pwm-tach,
   pwm-fan, pmbus/mp2975, acpi_power_meter, and lm70 drivers
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmZCnOsACgkQyx8mb86f
 mYGGIg//Z/P2SNdU+WztPIpLLu19zGe0S0PskGmw/3Ox5Wu95hOyv2FkABkbLOnI
 a0Q69ntPjKtwhziVgws9hcqM33++yz4J8k7Y3UJ7yrGtua4OCLtlm4po9NxomxwR
 5/iNBwDD2fWxOMTfAKCKanYLk+tgvB1xV0SfGN7jmTSL5GLwWZGtHYKzmgbNvdAN
 tAZGF9RlO4bj4eORFaGvbMyrLZuvT2zWzpcuqyvrZQZzcrFJzQgKqeGl6Jv+0Hsm
 LUOIlB8u82hTmyTsZ2PW9TI8sd7Q++3WilVvxB44cmridyst3Ucrcr1KlDBOu6oO
 gxCzHF/MAkQWa8UVmc3OAkfH9+VM3JxOfYNWHpcVNtEqucrJn+ryCrO33ZjUSjLK
 GdvLs0vFoImx1XSjVs8fUIVcsBs7FgkLuruxxJg7uElfYRGMyDzPaTMW//Iwqul6
 RX8/8Td2kYPGdiRDymE/ONQ5LIzZtUvnQUJap5ehHuZmVEIeybBHRXAAn8iG4mUg
 fQAB1imybjsV1yfulfOcA3P+izh/2wpeVlrQDsbMdiUEhD7Xhsrr+GFfIPrvWuGd
 IDWjhu2YP6t9R6yeA9H2W9MhiGNTZmv6bZerhS5InoR93d92pxwkPehwdrwV+mC2
 Ou9ULI9hmJPqEIdCENTCNj1TFUhEZtNhJxjLpaxoMYjx0FMU9aI=
 =68su
 -----END PGP SIGNATURE-----

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

Pull hwmon updates from Guenter Roeck:
 "New drivers:

   - Infineon XDP710

   - EC Chip driver for Lenovo ThinkStation motherboards

   - Analog Devices ADP1050

  Improved support for existing drivers:

   - emc1403: Convert to with_info API; Support for EMC1428 and EMC1438

   - nzxt-kraken3: Support for NZXT Kraken 2023

   - aquacomputer_d5next: Support for Octo flow sensors

   - pmbus/adm1275: Support for ADM1281

   - dell-smm: Supportt for Precision 7540 and G5 5505

  Other notable cleanup:

   - max6639: Use regmap

   - Remove unused structure fields from multiple drivers

   - Drop explicit initialization of struct i2c_device_id::driver_data
     to zero

   - Improve configuration mode handling in it87 driver

   - jc42: Drop support for I2C_CLASS_SPD

   - Various conversions to devicetree schema

   - Add HAS_IOPORT dependencies as needed

  Minor fixes and improvements to max31790, coretemp, aspeed-g6-pwm-tach,
  pwm-fan, pmbus/mp2975, acpi_power_meter, and lm70 drivers"

* tag 'hwmon-for-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (52 commits)
  hwmon: (nzxt-kraken3) Bail out for unsupported device variants
  hwmon: (emc1403) Add support for EMC1428 and EMC1438.
  hwmon: Drop explicit initialization of struct i2c_device_id::driver_data to 0 (part 2)
  hwmon: (emc1403) Add support for conversion interval configuration
  hwmon: (emc1403) Support 11 bit accuracy
  hwmon: (emc1403) Convert to with_info API
  hwmon: (max6639) Use regmap
  hwmon: (npcm750-pwm-fan) Remove another unused field in struct npcm7xx_cooling_device
  hwmon: (npcm750-pwm-fan) Remove an unused field in struct npcm7xx_cooling_device
  hwmon: (stts751) Remove an unused field in struct stts751_priv
  hwmon: Drop explicit initialization of struct i2c_device_id::driver_data to 0
  hwmon: (max31790) revise the scale to write pwm
  hwmon: (nzxt-kraken3) Add support for NZXT Kraken 2023 (standard and Elite) models
  hwmon: (nzxt-kraken3) Decouple device names from kinds
  hwmon: (it87) Remove tests nolonger required
  hwmon: (it87) Test for chipset before entering configuration mode
  hwmon: (it87) Do not enter configuration mode for some chiptypes
  hwmon: (it87) Rename FEAT_CONF_NOEXIT to FEAT_NOCONF as more descriptive of requirement
  hwmon: (pmbus) Add support for Infineon XDP710
  dt-bindings: hwmon: Add infineon xdp710 driver bindings
  ...
2024-05-14 14:51:51 -07:00
Linus Torvalds
07bbfc6aba regulator: Updates for v6.10
There's one API update here, a new API factoring out a common pattern
 for reference voltage supplies.  These are supplies uses as a reference
 by analogue circuits where the consumer requests and enables the supply,
 reads the voltage to calibrate the user and then never touches it again.
 This is factored out into a single operation which just returns the
 voltage and uses devm_ to manage the request and enable portion.
 
 Otherwise this has been a very quiet release, we've got some new device
 support, some small fixes, housekeeping and cleanup work but nothing
 substantial.
 
 There's also some non-regulator changes in here, a number of users for
 the new reference voltage API were merged along with it and some MFD
 changes were pulled in as dependencies for new driver work.
 
 Highlights:
 
  - Add a new API for single operation handling of reference voltages.
  - Support for Allwinner AXP717 and D1, and NXP PCA9561A.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmZB3mMACgkQJNaLcl1U
 h9DRmAf9Etp/ydeKGrbYD4K34Ptk4ZwchkTfvPEiNmJEDBlbcazRoeCF9asUVsDR
 ByggQCahCWhEa+exT+IBQYswpwFRd1oZChSgGUmIS/7pvQDdaPL+53Fnw8SfzmdS
 QygBEMNN8TGIu2Y+OqEEqINJ407NLbv2SbIlFX1CywZ5hDvCtvFdqhX/xCxTedBN
 wXlyj2BLe/xmbTGxr3Ssb+l8a0oe1BZvLO6ddrg8DtS92l1zJ0sEk+fegHSQGPRI
 wI4QehjEgphBsoGhybMGz3ny0nvSs3JkpgRiG/ly3cT97Cx6KSGctMtqjmy7Ynh5
 TM3Qq5DS37pBKIm79zmQFbL1z2A9Bw==
 =wV3x
 -----END PGP SIGNATURE-----

Merge tag 'regulator-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator updates from Mark Brown:
 "There's one API update here, a new API factoring out a common pattern
  for reference voltage supplies. These are supplies used as a reference
  by analogue circuits where the consumer requests and enables the
  supply, reads the voltage to calibrate the user and then never touches
  it again. This is factored out into a single operation which just
  returns the voltage and uses devm_ to manage the request and enable
  portion.

  Otherwise this has been a very quiet release, we've got some new
  device support, some small fixes, housekeeping and cleanup work but
  nothing substantial.

  There's also some non-regulator changes in here, a number of users for
  the new reference voltage API were merged along with it and some MFD
  changes were pulled in as dependencies for new driver work.

  Highlights:

   - Add a new API for single operation handling of reference voltages

   - Support for Allwinner AXP717 and D1, and NXP PCA9561A"

* tag 'regulator-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (33 commits)
  regulator: sun20i: Add Allwinner D1 LDOs driver
  regulator: dt-bindings: Add Allwinner D1 system LDOs
  regulator: Mention regulator id in error message about dummy supplies
  staging: iio: impedance-analyzer: ad5933: Use devm_regulator_get_enable_read_voltage()
  iio: frequency: admv1013: Use devm_regulator_get_enable_read_voltage()
  iio: addac: ad74115: Use devm_regulator_get_enable_read_voltage()
  hwmon: (adc128d818) simplify final return in probe
  regulator: devres: fix devm_regulator_get_enable_read_voltage() return
  hwmon: (da9052) Use devm_regulator_get_enable_read_voltage()
  hwmon: (adc128d818) Use devm_regulator_get_enable_read_voltage()
  regulator: devres: add API for reference voltage supplies
  regulator: rtq2208: Fix LDO discharge register and add vsel setting
  regulator: dt-bindings: fixed-regulator: Add a preferred node name
  regulator: axp20x: add support for the AXP717
  mfd: axp20x: Add support for AXP717 PMIC
  dt-bindings: mfd: x-powers,axp152: Document AXP717
  regulator: axp20x: fix typo-ed identifier
  dt-bindings: regulator: qcom,usb-vbus-regulator: Add PM7250B compatible
  regulator: pca9450: add pca9451a support
  regulator: dt-bindings: pca9450: add pca9451a support
  ...
2024-05-14 14:36:09 -07:00
Guenter Roeck
5fbf8734fb hwmon: (nzxt-kraken3) Bail out for unsupported device variants
Dan Carpenter reports:

Commit cbeb479ff4 ("hwmon: (nzxt-kraken3) Decouple device names
from kinds") from Apr 28, 2024 (linux-next), leads to the following
Smatch static checker warning:

	drivers/hwmon/nzxt-kraken3.c:957 kraken3_probe()
	error: uninitialized symbol 'device_name'.

Indeed, 'device_name' will be uninitizalized if an unknown product is
encountered. In practice this should not matter because the driver
should not instantiate on unknown products, but lets play safe and
bail out if that happens.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-hwmon/b1738c50-db42-40f0-a899-9c027c131ffb@moroto.mountain/
Cc: Jonas Malaco <jonas@protocubo.io>
Cc: Aleksa Savic <savicaleksa83@gmail.com>
Fixes: cbeb479ff4 ("hwmon: (nzxt-kraken3) Decouple device names from kinds")
Acked-by: Jonas Malaco <jonas@protocubo.io>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-12 16:50:11 -07:00
Lars Petter Mostad
c82337843d hwmon: (emc1403) Add support for EMC1428 and EMC1438.
EMC1428 and EMC1438 are similar to EMC14xx, but have eight temperature
channels, as well as signed data and limit registers. Chips currently
supported by this driver have unsigned registers only.

Signed-off-by: Lars Petter Mostad <larspm@gmail.com>
Link: https://lore.kernel.org/r/20240510142824.824332-1-lars.petter.mostad@appear.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-12 09:02:00 -07:00
Uwe Kleine-König
2fa365974c hwmon: Drop explicit initialization of struct i2c_device_id::driver_data to 0 (part 2)
These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.

This is a follow up to commit d8a66f3621 ("hwmon: Drop explicit
initialization of struct i2c_device_id::driver_data to 0") which I
created before identifying a few corner cases in my conversion script.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20240508072027.2119857-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-09 12:56:06 -07:00
Lakshmi Yadlapati
26e8383b11 hwmon: (pmbus/ucd9000) Increase delay from 250 to 500us
Following the failure observed with a delay of 250us, experiments were
conducted with various delays. It was found that a delay of 350us
effectively mitigated the issue.

To provide a more optimal solution while still allowing a margin for
stability, the delay is being adjusted to 500us.

Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
Link: https://lore.kernel.org/r/20240507194603.1305750-1-lakshmiy@us.ibm.com
Fixes: 8d655e6523 ("hwmon: (ucd90320) Add minimum delay between bus accesses")
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-09 09:37:06 -07:00
Guenter Roeck
6a8157812f hwmon: (emc1403) Add support for conversion interval configuration
The chips supported by the emc1403 driver support configurable
conversion rates. Add support for it.

Cc: Lars Petter Mostad <lars.petter.mostad@appear.net>
Tested-by: Lars Petter Mostad <lars.petter.mostad@appear.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-07 06:23:31 -07:00
Guenter Roeck
e77b204ad4 hwmon: (emc1403) Support 11 bit accuracy
Various temperature and limit registers support 11 bit accuracy.
Add support for it.

Cc: Lars Petter Mostad <lars.petter.mostad@appear.net>
Tested-by: Lars Petter Mostad <lars.petter.mostad@appear.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-07 06:23:27 -07:00
Guenter Roeck
1094360dc8 hwmon: (emc1403) Convert to with_info API
Convert driver to register with the hwmon subsystem using
devm_hwmon_device_register_with_info() instead of
devm_hwmon_device_register_with_groups() to simplify the code
and to reduce its size. As side effect, this also fixes a couple
of overflow problems when writing limit and hysteresis registers.

Cc: Lars Petter Mostad <lars.petter.mostad@appear.net>
Tested-by: Lars Petter Mostad <lars.petter.mostad@appear.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-07 06:23:21 -07:00
David Lechner
346fe0ce1f
hwmon: (adc128d818) simplify final return in probe
The final return in adc128d818_probe() can be simplified by using
PTR_ERR_OR_ZERO rather than an if statement.

Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240506-regulator-devm_regulator_get_enable_read_voltage-fixes-v1-2-356cdd152067@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-07 10:31:48 +09:00
Lukas Wunner
aa1fd9cdab hwmon: Use device_show_string() helper for sysfs attributes
Deduplicate sysfs ->show() callbacks which expose a string at a static
memory location.  Use the newly introduced device_show_string() helper
in the driver core instead by declaring those sysfs attributes with
DEVICE_STRING_ATTR_RO().

No functional change intended.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/23c2031acaa64f1c02f00e817c3f7e4466d17ab2.1713608122.git.lukas@wunner.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-04 17:37:03 +02:00
Aleksa Savic
d02abd57e7 hwmon: (corsair-cpro) Protect ccp->wait_input_report with a spinlock
Through hidraw, userspace can cause a status report to be sent
from the device. The parsing in ccp_raw_event() may happen in
parallel to a send_usb_cmd() call (which resets the completion
for tracking the report) if it's running on a different CPU where
bottom half interrupts are not disabled.

Add a spinlock around the complete_all() in ccp_raw_event() and
reinit_completion() in send_usb_cmd() to prevent race issues.

Fixes: 40c3a44542 ("hwmon: add Corsair Commander Pro driver")
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Acked-by: Marius Zachmann <mail@mariuszachmann.de>
Link: https://lore.kernel.org/r/20240504092504.24158-4-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-04 06:36:41 -07:00
Aleksa Savic
3a034a7b07 hwmon: (corsair-cpro) Use complete_all() instead of complete() in ccp_raw_event()
In ccp_raw_event(), the ccp->wait_input_report completion is
completed once. Since we're waiting for exactly one report in
send_usb_cmd(), use complete_all() instead of complete()
to mark the completion as spent.

Fixes: 40c3a44542 ("hwmon: add Corsair Commander Pro driver")
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Acked-by: Marius Zachmann <mail@mariuszachmann.de>
Link: https://lore.kernel.org/r/20240504092504.24158-3-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-04 06:36:41 -07:00
Aleksa Savic
e0cd85dc66 hwmon: (corsair-cpro) Use a separate buffer for sending commands
Introduce cmd_buffer, a separate buffer for storing only
the command that is sent to the device. Before this separation,
the existing buffer was shared for both the command and the
report received in ccp_raw_event(), which was copied into it.

However, because of hidraw, the raw event parsing may be triggered
in the middle of sending a command, resulting in outputting gibberish
to the device. Using a separate buffer resolves this.

Fixes: 40c3a44542 ("hwmon: add Corsair Commander Pro driver")
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Acked-by: Marius Zachmann <mail@mariuszachmann.de>
Link: https://lore.kernel.org/r/20240504092504.24158-2-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-04 06:36:41 -07:00
Naresh Solanki
45bf8305fb hwmon: (max6639) Use regmap
Add regmap support & remove local caching.

Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com>
Link: https://lore.kernel.org/r/20240503120020.3450972-1-naresh.solanki@9elements.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-03 09:20:04 -07:00
David Lechner
d72fd5228c
hwmon: (da9052) Use devm_regulator_get_enable_read_voltage()
We can reduce boilerplate code by using
devm_regulator_get_enable_read_voltage().

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240429-regulator-get-enable-get-votlage-v2-3-b1f11ab766c1@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-03 11:08:14 +09:00
David Lechner
cffb8d74bd
hwmon: (adc128d818) Use devm_regulator_get_enable_read_voltage()
We can reduce boilerplate code and eliminate the driver remove()
function by using devm_regulator_get_enable_read_voltage().

A new external_vref flag is added since we no longer have the handle
to the regulator to check if it is present.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240429-regulator-get-enable-get-votlage-v2-2-b1f11ab766c1@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-03 11:08:13 +09:00
Christophe JAILLET
1d4d673359 hwmon: (npcm750-pwm-fan) Remove another unused field in struct npcm7xx_cooling_device
In "struct npcm7xx_cooling_device", the 'pwm_clk_freq' field is only
written and never used.

Remove it and update npcm7xx_pwm_init() accordingly.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/2ff738663d40ac5ae3d0b4d2e688ff7e36032be8.1714505655.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-01 07:47:49 -07:00
Christophe JAILLET
cfdafddf16 hwmon: (npcm750-pwm-fan) Remove an unused field in struct npcm7xx_cooling_device
In "struct npcm7xx_cooling_device", the 'fan_clk_freq' field is unused.
Remove it.

Found with cppcheck, unusedStructMember.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/74eee8aa739f94b8c6425ce3e37a427ca92243ea.1714505655.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-01 07:47:49 -07:00
Christophe JAILLET
b2728c095c hwmon: (stts751) Remove an unused field in struct stts751_priv
In "struct stts751_priv", the 'smbus_timeout' field is unused.
Remove it.

Found with cppcheck, unusedStructMember.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/94ccf9caaa6b0101351bf381f09f4428c5e0835c.1714511322.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-01 07:47:49 -07:00
Uwe Kleine-König
d8a66f3621 hwmon: Drop explicit initialization of struct i2c_device_id::driver_data to 0
These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20240430085654.1028864-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-01 07:47:49 -07:00
Delphine CC Chiu
801fec8df5 hwmon: (max31790) revise the scale to write pwm
Since the value for PWMOUT Target Duty Cycle register is a 9 bit
left-justified value that ranges from 0 to 511 and is contained in 2
bytes.

There is an issue that the PWM signal recorded by oscilloscope would
not be on consistently if we set PWM to 100% to the driver.

It is because the LSB of the 9 bit would always be zero if it just
left shift 8 bit for the value that write to PWMOUT Target Duty
Cycle register.

Therefore, revise the scale of the value that was written to pwm input
from 255 to 511 and modify the value to left-justified value.

Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
Link: https://lore.kernel.org/r/20240416022211.859483-1-Delphine_CC_Chiu@wiwynn.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-05-01 07:47:45 -07:00
Aleksa Savic
8ec8d6c509 hwmon: (nzxt-kraken3) Add support for NZXT Kraken 2023 (standard and Elite) models
Add support for NZXT Kraken 2023 (standard) and NZXT Kraken 2023 Elite
all-in-one CPU coolers. These models communicate identically to the NZXT
Kraken Z-series (Z53 code paths) in all cases except when writing the
fan curve, where setting additional bits in the report is needed.

Reviewed-by: Jonas Malaco <jonas@protocubo.io>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20240428104812.14037-3-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-30 10:32:14 -07:00
Aleksa Savic
cbeb479ff4 hwmon: (nzxt-kraken3) Decouple device names from kinds
Prepare for the support of new models, for which the relationship
between device name (for hwmon and debugfs) and kind (for the selection
of appropriate code paths within this driver) will no longer be 1:1.

Originally-from: Jonas Malaco <jonas@protocubo.io>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20240428104812.14037-2-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-30 10:32:14 -07:00
Frank Crawford
79a4c239e0 hwmon: (it87) Remove tests nolonger required
Remove DMI tests for boards that are known to have issues with entering
configuration mode, as now we are testing the chips directly and no
longer need to rely on matching the board.

Leave the DMI table in place, for the nVIDIA board, and any future
expansions.

Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
Link: https://lore.kernel.org/r/20240428060653.2425296-5-frank@crawford.emu.id.au
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-30 10:32:14 -07:00
Frank Crawford
e58095cfc5 hwmon: (it87) Test for chipset before entering configuration mode
Major part of the change for the new method to avoid chipset issues.

The actual update does the following:

1) Lock the memory, but does not perform a SIO entry (previously it
would have performed an SIO entry).

2) Attempt to read the chipID.  This should be safe no matter which
chip we have.

3) If step (2) fails, then perform SIO entry and retry chipID read.  For
older chips and on failure it acts similarly to prior to this patch.

4) Set the sio_data->type, similar to previously.

5) If we have not performed an SIO entry, and this is not a chip type
with the NOCONF feature, then it will perform an SIO entry at this
point.

6) Proceed with setup as prior to this patch.

7) Any following access to the SIO registers will invoke the SIO entry
and SIO exit steps unless it is a chip with the NOCONF feature set.
This was set up in the previous patches in this patchset.

8) Update to the exit based on if it had performed a SIO entry or not.

Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
Link: https://lore.kernel.org/r/20240428060653.2425296-4-frank@crawford.emu.id.au
[groeck: s/intialised/initialized/]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-30 10:32:14 -07:00
Frank Crawford
e2e6a23f4b hwmon: (it87) Do not enter configuration mode for some chiptypes
Update the configuration mode entry code to allow conditional entry, and
apply to all calls.

Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
Link: https://lore.kernel.org/r/20240428060653.2425296-3-frank@crawford.emu.id.au
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-30 10:32:14 -07:00
Frank Crawford
f4f3e5de2e hwmon: (it87) Rename FEAT_CONF_NOEXIT to FEAT_NOCONF as more descriptive of requirement
Rename previous definitions to match the new information that they are
preinitialised as enabled and should not receive codes to enter or exit
configuration mode.

Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
Link: https://lore.kernel.org/r/20240428060653.2425296-2-frank@crawford.emu.id.au
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-30 10:32:14 -07:00
Peter Yin
35fe06d94e hwmon: (pmbus) Add support for Infineon XDP710
Add support for Infineon XDP710.This is a Hot-Swap Controller.

Signed-off-by: Peter Yin <peteryin.openbmc@gmail.com>
Link: https://lore.kernel.org/r/20240425153608.4003782-2-peteryin.openbmc@gmail.com
[groeck: s/microOhmRsense/micro_ohm_osense/g; declared array static]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-30 10:32:14 -07:00
Aleksa Savic
bf7b5a12bd hwmon: (aquacomputer_d5next) Add support for Octo flow sensor pulses
Add support for reading and writing the flow sensor pulses on
the Aquacomputer Octo. Implemented by David Flemstrom [1].

[1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/95

Originally-from: David Flemstrom <david.flemstrom@gmail.com>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20240417175037.32499-3-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-30 10:32:14 -07:00
Aleksa Savic
120584c728 hwmon: (aquacomputer_d5next) Add support for Octo flow sensor
Add support for reading the flow sensor value on
the Aquacomputer Octo. Implemented by David Flemstrom [1].

[1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/95

Originally-from: David Flemstrom <david.flemstrom@gmail.com>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20240417175037.32499-2-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-30 10:32:14 -07:00
David Ober
70118f85e6 hwmon: Add EC Chip driver for Lenovo ThinkStation motherboards
This addition adds in the ability for the system to scan
the EC chip in the Lenovo ThinkStation systems to get the
current fan RPM speeds the Maximum speed value for each
fan also provides the CPU, DIMM other thermal statuses

Signed-off-by: David Ober <dober6023@gmail.com>
Link: https://lore.kernel.org/r/20240328121250.331146-1-dober6023@gmail.com
[groeck: Dropped pointless case statements]
[Colin King: Fixed spelling error accesssible -> accessible]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-30 10:31:26 -07:00
Jose Ramon San Buenaventura
9163009027 hwmon: (pmbus/adm1275) add adm1281 support
Add support for adm1281 which is similar to adm1275 and other chips
of the series.

Signed-off-by: Jose Ramon San Buenaventura <jose.sanbuenaventura@analog.com>
Link: https://lore.kernel.org/r/20240425070948.25788-3-jose.sanbuenaventura@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:43 -07:00
Ricardo Neri
f0c344c000 hwmon: (coretemp) Extend the bitmask to read temperature to 0xff
The Intel Software Development manual defines the temperature digital
readout as the bits [22:16] of the IA32_[PACKAGE]_THERM_STATUS registers.
Bit 23 is specified as reserved.

In recent processors, however, the temperature digital readout uses bits
[23:16]. In those processors, using the bitmask 0x7f would lead to
incorrect readings if the temperature deviates from TjMax by more than
127 degrees Celsius.

Although not guaranteed, bit 23 is likely to be 0 in processors from a few
generations ago. The temperature reading would still be correct in those
processors when using a 0xff bitmask.

Model-specific provisions can be made for older processors in which bit 23
is not 0 should the need arise.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Link: https://lore.kernel.org/r/20240425171311.19519-4-ricardo.neri-calderon@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:43 -07:00
Heiner Kallweit
f4a86616d1 hwmon: (jc42) Remove I2C_CLASS_SPD support
Last host driver supporting I2C_CLASS_SPD was i801. Now that I2C_CLASS_SPD
support has been removed there, we can remove it here too.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/3c4a1715-bfbb-4ae2-b35f-2f20f95e4932@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:33 -07:00
Uwe Kleine-König
e27cbb607f hwmon: (aspeed-g6-pwm-tach) Convert to platform remove callback returning void
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: Andrew Jeffery <andrew@codeconstruct.com.au>
Link: https://lore.kernel.org/r/20240409085552.19868-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:33 -07:00
Andy Shevchenko
dfd977d85b hwmon: (pwm-fan) Make use of device properties
Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Add mod_devicetable.h include.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20240404191323.3547465-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:33 -07:00
Andy Shevchenko
9c871df02a hwmon: (pwm-fan) Convert to use of_property_read_u32_array()
This is a preparatory change to fulfill further conversion
the driver to be OF-independent. The independent code has
no analogue API that can read the value by index in the device
property array.

Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240404191323.3547465-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:33 -07:00
Niklas Schnelle
523315a911 hwmon: add HAS_IOPORT dependencies
In a future patch HAS_IOPORT=n will disable inb()/outb() and friends at
compile time. We thus need to add HAS_IOPORT as dependency for those
drivers using them.

Acked-by: Guenter Roeck <linux@roeck-us.net>
Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Link: https://lore.kernel.org/r/20240404124700.3807842-2-schnelle@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:33 -07:00
Andy Shevchenko
73bc2357de hwmon: (pmbus/mp2975) Use i2c_get_match_data()
Use preferred i2c_get_match_data() instead of of_device_get_match_data()
to get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240325120952.3019767-4-andriy.shevchenko@linux.intel.com
[groeck: Dropped __maybe_unused from mp2975_of_match]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:33 -07:00
Andy Shevchenko
9050b39b2f hwmon: (pmbus/mp2975) Constify local pointers to pmbus_driver_info
Constify the local variables pointing to "struct pmbus_driver_info" and
other encoding params to annotate the function is not modifying pointed
data.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240325120952.3019767-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:33 -07:00
Andy Shevchenko
d2bc4a994a hwmon: (pmbus/mp2975) Replace home made version of __assign_bit()
The newly introduced SWAP() macro is quite generic by naming, but
moreover it's a repetition of the existing __assign_bit().
With this applied, add a missing bits.h (via now required bitops.h).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240325120952.3019767-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:33 -07:00
Andy Shevchenko
9c3793629d hwmon: (pmbus/adp1050) Don't use "proxy" headers
Update header inclusions to follow IWYU (Include What You Use)
principle.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240325124156.3036266-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:19 -07:00
Seiji Nishikawa
c84e93da8b hwmon: (dell-smm) Add Dell Precision 7540 to fan control whitelist
Add Precision 7540 to the fan control whitelist, in addition to 7510.

Signed-off-by: Seiji Nishikawa <snishika@redhat.com>
Link: https://lore.kernel.org/r/20240325045913.385853-2-snishika@redhat.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:19 -07:00
Radu Sabau
04f175954d hwmon: (pmbus) Add driver for ADP1050
Add support for ADP1050 Digital Controller for Isolated Power Supplies
with PMBus interface Voltage, Current and Temperature Monitor.

The ADP1050 implements several features to enable a robust
system of parallel and redundant operation for customers who
require high availability. The device can measure voltage,
current and temperature that can be used in different
techniques to identify and safely shut down an erroneous
power supply in parallel operation mode.

Signed-off-by: Radu Sabau <radu.sabau@analog.com>
Link: https://lore.kernel.org/r/20240321142201.10330-2-radu.sabau@analog.com
[groeck: Fixed corrupted link in documentation]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:07:35 -07:00
Kai-Heng Feng
71113b9be4 hwmon: (acpi_power_meter) Ensure IPMI space handler is ready on Dell systems
The following error can be observed at boot:
[    3.717920] ACPI Error: No handler for Region [SYSI] (00000000ab9e62c5) [IPMI] (20230628/evregion-130)
[    3.717928] ACPI Error: Region IPMI (ID=7) has no handler (20230628/exfldio-261)

[    3.717936] No Local Variables are initialized for Method [_GHL]

[    3.717938] No Arguments are initialized for method [_GHL]

[    3.717940] ACPI Error: Aborting method \_SB.PMI0._GHL due to previous error (AE_NOT_EXIST) (20230628/psparse-529)
[    3.717949] ACPI Error: Aborting method \_SB.PMI0._PMC due to previous error (AE_NOT_EXIST) (20230628/psparse-529)
[    3.717957] ACPI: \_SB_.PMI0: _PMC evaluation failed: AE_NOT_EXIST

On Dell systems several methods of acpi_power_meter access variables in
IPMI region [0], so wait until IPMI space handler is installed by
acpi_ipmi and also wait until SMI is selected to make the space handler
fully functional.

Since the dependency is inside BIOS's ASL code and it's not
discoverable, so use this fixup is a hack to workaround BIOS issue.

[0] https://www.dell.com/support/manuals/en-us/redhat-enterprise-linux-v8.0/rhel8_rn_pub/advanced-configuration-and-power-interface-acpi-error-messages-displayed-in-dmesg?guid=guid-0d5ae482-1977-42cf-b417-3ed5c3f5ee62

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20240320084317.366853-2-kai.heng.feng@canonical.com
[groeck: Simplified added code]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:07:34 -07:00
Kousik Sanagavarapu
b18c01a4c8 hwmon: (lm70) fix links in doc and comments
Update links in the documentation and in-code comments which point to
the datasheet.

The current links don't work because National Semiconductor (which is the
original manufacturer of this chip) has been a part of Texas Instruments
since 2011 and http://www.national.com/ doesn't work anymore.

Fixes: e1a8e913f9 ("[PATCH] lm70: New hardware monitoring driver")
Signed-off-by: Kousik Sanagavarapu <five231003@gmail.com>
Link: https://lore.kernel.org/r/20240318154540.90613-3-five231003@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:07:34 -07:00
Patrick Rudolph
c7506a2b5a hwmon: (pmbus/mp2975) Fix IRQ masking
The MP2971/MP2973 use a custom 16bit register format for
SMBALERT_MASK which doesn't follow the PMBUS specification.

Map the PMBUS defined bits used by the common code onto the custom
format used by MPS and since the SMBALERT_MASK is currently never read
by common code only implement the mapping for write transactions.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com>
Link: https://lore.kernel.org/r/20240318174406.3782306-1-naresh.solanki@9elements.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:07:34 -07:00
Tobias Jakobi
df43ade4cb hwmon: (dell-smm) Add Dell G5 5505 to DMI table
Enables reading the speed of the CPU and GPU fan on the G5.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20240310220710.896230-1-tjakobi@math.uni-bielefeld.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:07:34 -07:00
Uwe Kleine-König
79dedfadb7 hwmon: (aspeed-g6-pwm-tacho): Make use of devm_pwmchip_alloc() function
This prepares the aspeed-g6-pwm-tacho driver to further changes of the
pwm core outlined in the commit introducing devm_pwmchip_alloc(). There
is no intended semantical change and the driver should behave as before.

Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/e95e41eea5a138ae206c9116ba3cb1d9e0178284.1710777536.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2024-04-26 21:29:16 +02:00
Uwe Kleine-König
940052bcbc hwmon: (aspeed-g6-pwm-tacho): Make use of pwmchip_parent() accessor
struct pwm_chip::dev is about to change. To not have to touch this
driver in the same commit as struct pwm_chip::dev, use the accessor
function provided for exactly this purpose.

Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/5c6a11dd10cd29e0f7bfaa1fdef145523347cb58.1710777536.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2024-04-26 21:29:16 +02:00
Linus Torvalds
e5eb28f6d1 - Kuan-Wei Chiu has developed the well-named series "lib min_heap: Min
heap optimizations".
 
 - Kuan-Wei Chiu has also sped up the library sorting code in the series
   "lib/sort: Optimize the number of swaps and comparisons".
 
 - Alexey Gladkov has added the ability for code running within an IPC
   namespace to alter its IPC and MQ limits.  The series is "Allow to
   change ipc/mq sysctls inside ipc namespace".
 
 - Geert Uytterhoeven has contributed some dhrystone maintenance work in
   the series "lib: dhry: miscellaneous cleanups".
 
 - Ryusuke Konishi continues nilfs2 maintenance work in the series
 
 	"nilfs2: eliminate kmap and kmap_atomic calls"
 	"nilfs2: fix kernel bug at submit_bh_wbc()"
 
 - Nathan Chancellor has updated our build tools requirements in the
   series "Bump the minimum supported version of LLVM to 13.0.1".
 
 - Muhammad Usama Anjum continues with the selftests maintenance work in
   the series "selftests/mm: Improve run_vmtests.sh".
 
 - Oleg Nesterov has done some maintenance work against the signal code
   in the series "get_signal: minor cleanups and fix".
 
 Plus the usual shower of singleton patches in various parts of the tree.
 Please see the individual changelogs for details.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZfMnvgAKCRDdBJ7gKXxA
 jjKMAP4/Upq07D4wjkMVPb+QrkipbbLpdcgJ++q3z6rba4zhPQD+M3SFriIJk/Xh
 tKVmvihFxfAhdDthseXcIf1nBjMALwY=
 =8rVc
 -----END PGP SIGNATURE-----

Merge tag 'mm-nonmm-stable-2024-03-14-09-36' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull non-MM updates from Andrew Morton:

 - Kuan-Wei Chiu has developed the well-named series "lib min_heap: Min
   heap optimizations".

 - Kuan-Wei Chiu has also sped up the library sorting code in the series
   "lib/sort: Optimize the number of swaps and comparisons".

 - Alexey Gladkov has added the ability for code running within an IPC
   namespace to alter its IPC and MQ limits. The series is "Allow to
   change ipc/mq sysctls inside ipc namespace".

 - Geert Uytterhoeven has contributed some dhrystone maintenance work in
   the series "lib: dhry: miscellaneous cleanups".

 - Ryusuke Konishi continues nilfs2 maintenance work in the series

	"nilfs2: eliminate kmap and kmap_atomic calls"
	"nilfs2: fix kernel bug at submit_bh_wbc()"

 - Nathan Chancellor has updated our build tools requirements in the
   series "Bump the minimum supported version of LLVM to 13.0.1".

 - Muhammad Usama Anjum continues with the selftests maintenance work in
   the series "selftests/mm: Improve run_vmtests.sh".

 - Oleg Nesterov has done some maintenance work against the signal code
   in the series "get_signal: minor cleanups and fix".

Plus the usual shower of singleton patches in various parts of the tree.
Please see the individual changelogs for details.

* tag 'mm-nonmm-stable-2024-03-14-09-36' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (77 commits)
  nilfs2: prevent kernel bug at submit_bh_wbc()
  nilfs2: fix failure to detect DAT corruption in btree and direct mappings
  ocfs2: enable ocfs2_listxattr for special files
  ocfs2: remove SLAB_MEM_SPREAD flag usage
  assoc_array: fix the return value in assoc_array_insert_mid_shortcut()
  buildid: use kmap_local_page()
  watchdog/core: remove sysctl handlers from public header
  nilfs2: use div64_ul() instead of do_div()
  mul_u64_u64_div_u64: increase precision by conditionally swapping a and b
  kexec: copy only happens before uchunk goes to zero
  get_signal: don't initialize ksig->info if SIGNAL_GROUP_EXIT/group_exec_task
  get_signal: hide_si_addr_tag_bits: fix the usage of uninitialized ksig
  get_signal: don't abuse ksig->info.si_signo and ksig->sig
  const_structs.checkpatch: add device_type
  Normalise "name (ad@dr)" MODULE_AUTHORs to "name <ad@dr>"
  dyndbg: replace kstrdup() + strchr() with kstrdup_and_replace()
  list: leverage list_is_head() for list_entry_is_head()
  nilfs2: MAINTAINERS: drop unreachable project mirror site
  smp: make __smp_processor_id() 0-argument macro
  fat: fix uninitialized field in nostale filehandles
  ...
2024-03-14 18:03:09 -07:00
Linus Torvalds
66fd6d0bd7 platform-drivers-x86 for v6.9-1
Highlights:
  - acer-wmi:		New HW support
  - amd/pmf:		Support for new revision of heartbeat notify
  - asus-wmi:		Correctly handle HW without LEDs
  - fujitsu-laptop:	Battery charge control support
  - hp-wmi:		Support for new thermal profiles
  - ideapad-laptop:	Support for refresh rate key
  - intel/pmc:		Put AI accelerator (GNA) into D3 if it has no
 			driver to allow entry into low-power modes, and
 			temporarily removed Lunar Lake SSRAM support due
 			to breaking FW changes causing probe fail
 			(further breaking FW changes are still pending)
  - pmc/punit_atom:	Report devices that prevent reacing low power
 			levels
  - surface:		Fan speed function support
  - thinkpad_acpi:	Support for more sperial keys and complete the
 			list of models with non-standard fan registers
  - touchscreen_dmi:	New HW support
  - wmi:			Continued modernization efforts
  - Removal of obsoleted ledtrig-audio call and the related dependency
  - Debug & metrics interface improvements
  - Miscellaneous cleanups / fixes / improvements
 
 The following is an automated shortlog grouped by driver:
 
 acer-wmi:
  -  Add predator_v4 module parameter
  -  Add support for Acer PH16-71
 
 amd/hsmp:
  -  Add support for ACPI based probing
  -  Cache pci_dev in struct hsmp_socket
  -  Change devm_kzalloc() to devm_kcalloc()
  -  Check num_sockets against MAX_AMD_SOCKETS
  -  Create static func to handle platdev
  -  Define a struct to hold mailbox regs
  -  Move dev from platdev to hsmp_socket
  -  Move hsmp_test to probe
  -  Non-ACPI support for AMD F1A_M00~0Fh
  -  Remove extra parenthesis and add a space
  -  Restructure sysfs group creation
 
 amd/pmf:
  -  Add missing __iomem attribute to policy_base
  -  Add support to get APTS index numbers for static slider
  -  Add support to get sbios requests in PMF driver
  -  Add support to get sps default APTS index values
  -  Add support to notify sbios heart beat event
  -  Differentiate PMF ACPI versions
  -  Disable debugfs support for querying power thermals
  -  Do not use readl() for policy buffer access
  -  Fix possible out-of-bound memory accesses
  -  Fix return value of amd_pmf_start_policy_engine()
  -  Update sps power thermals according to the platform-profiles
  -  Use struct for cookie header
 
 asus-wmi:
  -  Consider device is absent when the read is ~0
  -  Revert: Support WMI event queue
 
 clk: x86:
  -  Move clk-pmc-atom register defines to include/linux/platform_data/x86/pmc_atom.h
 
 dell-privacy:
  -  Remove usage of wmi_has_guid()
 
 Documentation/x86/amd/hsmp:
  -  Updating urls
 
 drivers/mellanox:
  -  Convert snprintf to sysfs_emit
 
 fujitsu-laptop:
  -  Add battery charge control support
 
 hp-wmi:
  -  Add thermal profile support for 8BAD boards
  -  Tidy up module source code
 
 ideapad-laptop:
  -  map Fn + R key to KEY_REFRESH_RATE_TOGGLE
  -  support Fn+R dual-function key
 
 Input:
  -  allocate keycode for Display refresh rate toggle
 
 intel/ifs:
  -  Add an entry rendezvous for SAF
  -  Add current batch number to trace output
  -  Remove unnecessary initialization of 'ret'
  -  Replace the exit rendezvous with an entry rendezvous for ARRAY_BIST
  -  Trace on all HT threads when executing a test
 
 intel/pmc/arl:
  -  Put GNA device in D3
 
 intel/pmc:
  -  Improve PKGC residency counters debug
 
 intel/pmc/lnl:
  -  Remove SSRAM support
 
 intel_scu_ipcutil:
  -  Make scu static
 
 intel_scu_pcidrv:
  -  Remove unused intel-mid.h
 
 intel_scu_wdt:
  -  Remove unused intel-mid.h
 
 intel/tpmi:
  -  Change vsec offset to u64
 
 intel/vsec:
  -  Remove nuisance message
 
 ISST:
  -  Allow reading core-power state on HWP disabled systems
 
 mlxbf-pmc:
  -  Cleanup signed/unsigned mix-up
  -  fix signedness bugs
  -  Ignore unsupported performance blocks
 
 mlxbf-pmc: mlxbf_pmc_event_list():
  -  make size ptr optional
 
 mlxbf-pmc:
  -  Replace uintN_t with kernel-style types
 
 mlxreg-hotplug:
  -  Remove redundant NULL-check
 
 pmc_atom:
  -  Annotate d3_sts register bit defines
  -  Check state of PMC clocks on s2idle
  -  Check state of PMC managed devices on s2idle
 
 silicom-platform:
  - clean up a check
 
 surface: aggregator_registry:
  -  add entry for fan speed
 
 thinkpad_acpi:
  -  Add more ThinkPads with non-standard reg address for fan
  -  Fix to correct wrong temp reporting on some ThinkPads
  -  remove redundant assignment to variable i
  -  Simplify thermal mode checking
  -  Support for mode FN key
 
 touchscreen_dmi:
  -  Add an extra entry for a variant of the Chuwi Vi8 tablet
 
 wmi:
  -  Always evaluate _WED when receiving an event
  -  Check if event data is not NULL
  -  Check if WMxx control method exists
  -  Do not instantiate older WMI drivers multiple times
  -  Ignore duplicated GUIDs in legacy matches
  -  Make input buffer mandatory when evaluating methods
  -  Prevent incompatible event driver from probing
  -  Remove obsolete duplicate GUID allowlist
  -  Remove unnecessary out-of-memory message
  -  Replace pr_err() with dev_err()
  -  Stop using ACPI device class
  -  Update documentation regarding _WED
  -  Use ACPI device name in netlink event
  -  Use FW_BUG when warning about missing control methods
 
 x86/atom:
  -  Check state of Punit managed devices on s2idle
 
 x86: ibm_rtl:
  -  make rtl_subsys const
 
 x86: wmi:
  -  make wmi_bus_type const
 
 platform/x86:
  -  make fw_attr_class constant
  -  remove obsolete calls to ledtrig_audio_get
 
 Merges:
  -  Merge tag 'platform-drivers-x86-v6.8-2' into pdx/for-next
  -  Merge tag 'platform-drivers-x86-v6.8-4' into pdx86/for-next
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQSCSUwRdwTNL2MhaBlZrE9hU+XOMQUCZfLZKgAKCRBZrE9hU+XO
 MWqnAQCZW0KiSzXbJkTN4GWlMOqnlaJsiflnPeVNxH59bDUTeQEA/OdSzyiDUqKr
 zJcGnOyILuQ3wCvQ5SuqRCwjFHXOQg0=
 =8y6r
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver updates from Ilpo Järvinen:

 - New acer-wmi HW support

 - Support for new revision of amd/pmf heartbeat notify

 - Correctly handle asus-wmi HW without LEDs

 - fujitsu-laptop battery charge control support

 - Support for new hp-wmi thermal profiles

 - Support ideapad-laptop refresh rate key

 - Put intel/pmc AI accelerator (GNA) into D3 if it has no driver to
   allow entry into low-power modes, and temporarily removed Lunar Lake
   SSRAM support due to breaking FW changes causing probe fail (further
   breaking FW changes are still pending)

 - Report pmc/punit_atom devices that prevent reacing low power levels

 - Surface Fan speed function support

 - Support for more sperial keys and complete the list of models with
   non-standard fan registers in thinkpad_acpi

 - New DMI touchscreen HW support

 - Continued modernization efforts of wmi

 - Removal of obsoleted ledtrig-audio call and the related dependency

 - Debug & metrics interface improvements

 - Miscellaneous cleanups / fixes / improvements

* tag 'platform-drivers-x86-v6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (87 commits)
  platform/x86/intel/pmc: Improve PKGC residency counters debug
  platform/x86: asus-wmi: Consider device is absent when the read is ~0
  Documentation/x86/amd/hsmp: Updating urls
  platform/mellanox: mlxreg-hotplug: Remove redundant NULL-check
  platform/x86/amd/pmf: Update sps power thermals according to the platform-profiles
  platform/x86/amd/pmf: Add support to get sps default APTS index values
  platform/x86/amd/pmf: Add support to get APTS index numbers for static slider
  platform/x86/amd/pmf: Add support to notify sbios heart beat event
  platform/x86/amd/pmf: Add support to get sbios requests in PMF driver
  platform/x86/amd/pmf: Disable debugfs support for querying power thermals
  platform/x86/amd/pmf: Differentiate PMF ACPI versions
  x86/platform/atom: Check state of Punit managed devices on s2idle
  platform/x86: pmc_atom: Check state of PMC clocks on s2idle
  platform/x86: pmc_atom: Check state of PMC managed devices on s2idle
  platform/x86: pmc_atom: Annotate d3_sts register bit defines
  clk: x86: Move clk-pmc-atom register defines to include/linux/platform_data/x86/pmc_atom.h
  platform/x86: make fw_attr_class constant
  platform/x86/intel/tpmi: Change vsec offset to u64
  platform/x86: intel_scu_pcidrv: Remove unused intel-mid.h
  platform/x86: intel_scu_wdt: Remove unused intel-mid.h
  ...
2024-03-14 10:44:09 -07:00
Linus Torvalds
15223fdbdf hwmon updates for v6.9
* New drivers for
 
   - Amphenol ChipCap 2
 
   - ASPEED g6 PWM/Fan tach
 
   - Astera Labs PT5161L retimer
 
   - ASUS ROG RYUJIN II 360 AIO cooler
 
   - LTC4282
 
   - Microsoft Surface devices
 
   - MPS MPQ8785 Synchronous Step-Down Converter
 
   - NZXT Kraken X and Z series AIO CPU coolers
 
 * Additional chip support in existing drivers
 
   - Ayaneo Air Plus 7320u (oxp-sensors)
 
   - INA260 (ina2xx)
 
   - XPS 9315 (dell-smm)
 
   - MSI customer ID (nct6683)
 
 * Devicetree bindings updates
 
   - Common schema for hardware monitoring devices
 
   - Common schema for fans
 
   - Update chip descriptions to use common schema
 
   - Document regulator properties in several drivers
 
   - Explicit bindings for infineon buck converters
 
 * Other improvements
 
   - Replaced rbtree with maple tree register cache in several drivers
 
   - Added support for humidity min/max alarm and volatage fault attributes
     to hwmon core
 
   - Dropped non-functional I2C_CLASS_HWMON support for drivers w/o detect()
 
   - Dropped obsolete and redundant entried from MAINTAINERS
 
   - Cleaned up axi-fan-control and coretemp drivers
 
   - Minor fixes and improvements in several other drivers
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmXvI8QACgkQyx8mb86f
 mYFWTQ/9Hz4QfgIueAEhWGy0XORt7nSCeexkWIR341iyRk4LQA0UjDQg3+Ub5Hi1
 7IBGDNi124S1I/W8fJl1KFgXjbirhuzpHq4DF60Ty+egTZ9IZpu3uySR4mubixYm
 J3el7SIJBvs3SgMFdS/HCtJqeU5HLk+1NjfWDmnq0Z27GHzEy/Nglj2TTO1CjMz/
 tZ/LOWkdG5tMbwI8SZ/mBNMXMpYp/jnUZbrMxgZ/y+07R3jP7i1GWRjq5ZGuWaP6
 SQEs4vfss/y6WUSZZenIIigRIAiAnsNIrjUjrMKPdf0EkjB+0ljn/jLXpAsUU6fL
 07Uy+AwQb89PPWIKHdldn7/MYaR3zU+LwKwPbjULuvpo6Cj87WcIP/x7QqL//Ise
 Ix2Buy/oWoVHKG7Gtf+mF+Ott5MeFgj6pVsCN4IAYYdyai0GPM3RpFAcrIXFCjsE
 i3M5aRC46Yy8Ba6ov3Jmlh83kc9LauJrlCxIxIXTlUJIZiW7a5w083QDSaw3qQdB
 hukwfC8wOzpEsQngkBQyRSpF468lASzc4lp++tPLS/W0zxBrgrnHvgXTHnN8IxvQ
 ocuD5tVMg9gE2xT88t8BHTcw2uv03U5RoXY+nucbxA+Y/aT2t+jZhX9cPbq4+Rhe
 v7XDGMxcBYgtfwx6JT97DKqW9qLc01k8wxonCOrUop6B/+MdRbw=
 =BTB3
 -----END PGP SIGNATURE-----

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

Pull hwmon updates from Guenter Roeck:
 "New drivers:
   - Amphenol ChipCap 2
   - ASPEED g6 PWM/Fan tach
   - Astera Labs PT5161L retimer
   - ASUS ROG RYUJIN II 360 AIO cooler
   - LTC4282
   - Microsoft Surface devices
   - MPS MPQ8785 Synchronous Step-Down Converter
   - NZXT Kraken X and Z series AIO CPU coolers

  Additional chip support in existing drivers:
   - Ayaneo Air Plus 7320u (oxp-sensors)
   - INA260 (ina2xx)
   - XPS 9315 (dell-smm)
   - MSI customer ID (nct6683)

  Devicetree bindings updates:
   - Common schema for hardware monitoring devices
   - Common schema for fans
   - Update chip descriptions to use common schema
   - Document regulator properties in several drivers
   - Explicit bindings for infineon buck converters

  Other improvements:
   - Replaced rbtree with maple tree register cache in several drivers
   - Added support for humidity min/max alarm and volatage fault
     attributes to hwmon core
   - Dropped non-functional I2C_CLASS_HWMON support for drivers w/o
     detect()
   - Dropped obsolete and redundant entried from MAINTAINERS
   - Cleaned up axi-fan-control and coretemp drivers
   - Minor fixes and improvements in several other drivers"

* tag 'hwmon-for-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (70 commits)
  hwmon: (dell-smm) Add XPS 9315 to fan control whitelist
  hwmon: (aspeed-g6-pwm-tacho): Support for ASPEED g6 PWM/Fan tach
  dt-bindings: hwmon: Support Aspeed g6 PWM TACH Control
  dt-bindings: hwmon: fan: Add fan binding to schema
  dt-bindings: hwmon: tda38640: Add interrupt & regulator properties
  hwmon: (amc6821) add of_match table
  dt-bindings: hwmon: lm75: use common hwmon schema
  hwmon: (sis5595) drop unused DIV_TO_REG function
  dt-bindings: hwmon: reference common hwmon schema
  dt-bindings: hwmon: lltc,ltc4286: use common hwmon schema
  dt-bindings: hwmon: adi,adm1275: use common hwmon schema
  dt-bindings: hwmon: ti,ina2xx: use common hwmon schema
  dt-bindings: hwmon: add common properties
  hwmon: (pmbus/ir38064) Use PMBUS_REGULATOR_ONE to declare regulator
  hwmon: (pmbus/lm25066) Use PMBUS_REGULATOR_ONE to declare regulator
  hwmon: (pmbus/tda38640) Use PMBUS_REGULATOR_ONE to declare regulator
  regulator: dt-bindings: promote infineon buck converters to their own binding
  dt-bindings: hwmon/pmbus: ti,lm25066: document regulators
  dt-bindings: hwmon: nuvoton,nct6775: Add compatible value for NCT6799
  MAINTAINERS: Drop redundant hwmon entries
  ...
2024-03-13 11:26:58 -07:00
Armin Wolf
a66ccfc253
platform/x86: wmi: Do not instantiate older WMI drivers multiple times
Many older WMI drivers cannot be instantiated multiple times for
two reasons:

- they are using the legacy GUID-based WMI API
- they are singletons (with global state)

Prevent such WMI drivers from binding to WMI devices with a duplicated
GUID, as this would mean that the WMI driver will be instantiated at
least two times (one for the original GUID and one for the duplicated
GUID).
WMI drivers which can be instantiated multiple times can signal this
by setting a flag inside struct wmi_driver.

Tested on a ASUS Prime B650-Plus.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20240226193557.2888-2-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2024-03-12 12:47:35 +02:00
Linus Torvalds
ca7e917769 Rework of APIC enumeration and topology evaluation:
The current implementation has a couple of shortcomings:
 
   - It fails to handle hybrid systems correctly.
 
   - The APIC registration code which handles CPU number assignents is in
     the middle of the APIC code and detached from the topology evaluation.
 
   - The various mechanisms which enumerate APICs, ACPI, MPPARSE and guest
     specific ones, tweak global variables as they see fit or in case of
     XENPV just hack around the generic mechanisms completely.
 
   - The CPUID topology evaluation code is sprinkled all over the vendor
     code and reevaluates global variables on every hotplug operation.
 
   - There is no way to analyze topology on the boot CPU before bringing up
     the APs. This causes problems for infrastructure like PERF which needs
     to size certain aspects upfront or could be simplified if that would be
     possible.
 
   - The APIC admission and CPU number association logic is incomprehensible
     and overly complex and needs to be kept around after boot instead of
     completing this right after the APIC enumeration.
 
 This update addresses these shortcomings with the following changes:
 
   - Rework the CPUID evaluation code so it is common for all vendors and
     provides information about the APIC ID segments in a uniform way
     independent of the number of segments (Thread, Core, Module, ..., Die,
     Package) so that this information can be computed instead of rewriting
     global variables of dubious value over and over.
 
   - A few cleanups and simplifcations of the APIC, IO/APIC and related
     interfaces to prepare for the topology evaluation changes.
 
   - Seperation of the parser stages so the early evaluation which tries to
     find the APIC address can be seperately overridden from the late
     evaluation which enumerates and registers the local APIC as further
     preparation for sanitizing the topology evaluation.
 
   - A new registration and admission logic which
 
      - encapsulates the inner workings so that parsers and guest logic
        cannot longer fiddle in it
 
      - uses the APIC ID segments to build topology bitmaps at registration
        time
 
      - provides a sane admission logic
 
      - allows to detect the crash kernel case, where CPU0 does not run on
        the real BSP, automatically. This is required to prevent sending
        INIT/SIPI sequences to the real BSP which would reset the whole
        machine. This was so far handled by a tedious command line
        parameter, which does not even work in nested crash scenarios.
 
      - Associates CPU number after the enumeration completed and prevents
        the late registration of APICs, which was somehow tolerated before.
 
   - Converting all parsers and guest enumeration mechanisms over to the
     new interfaces.
 
     This allows to get rid of all global variable tweaking from the parsers
     and enumeration mechanisms and sanitizes the XEN[PV] handling so it can
     use CPUID evaluation for the first time.
 
   - Mopping up existing sins by taking the information from the APIC ID
     segment bitmaps.
 
     This evaluates hybrid systems correctly on the boot CPU and allows for
     cleanups and fixes in the related drivers, e.g. PERF.
 
 The series has been extensively tested and the minimal late fallout due to
 a broken ACPI/MADT table has been addressed by tightening the admission
 logic further.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmXuDawTHHRnbHhAbGlu
 dXRyb25peC5kZQAKCRCmGPVMDXSYobE7EACngItF+UOTCoCV6och2lL6HVoIdZD1
 Y5oaAgD+WzQSz/lBkH6b9kZSyvjlMo6O9GlnGX+ii+VUnijDp4VrspnxbJDaKEq3
 gOfsSg2Tk+ps50HqMcZawjjBYJb/TmvKwEV2XuzIBPOONSWLNjvN7nBSzLl1eF9/
 8uCE39/8aB5K3GXryRyXdo2uLu6eHTVC0aYFu/kLX1/BbVqF5NMD3sz9E9w8+D/U
 MIIMEMXy4Fn+P2o0vVH+gjUlwI76mJbB1WqCX/sqbVacXrjl3KfNJRiisTFIOOYV
 8o+rIV0ef5X9xmZqtOXAdyZQzj++Gwmz9+4TU1M4YHtS7UkYn6AluOjvVekCc+gc
 qXE3WhqKfCK2/carRMLQxAMxNeRylkZG+Wuv1Qtyjpe9JX2dTqtems0f4DMp9DKf
 b7InO3z39kJanpqcUG2Sx+GWanetfnX+0Ho2Moqu6Xi+2ATr1PfMG/Wyr5/WWOfV
 qApaHSTwa+J43mSzP6BsXngEv085EHSGM5tPe7u46MCYFqB21+bMl+qH82KjMkOe
 c6uZovFQMmX2WBlqJSYGVCH+Jhgvqq8HFeRs19Hd4enOt3e6LE3E74RBVD1AyfLV
 1b/m8tYB/o871ZlEZwDCGVrV/LNnA7PxmFpq5ZHLpUt39g2/V0RH1puBVz1e97pU
 YsTT7hBCUYzgjQ==
 =/5oR
 -----END PGP SIGNATURE-----

Merge tag 'x86-apic-2024-03-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 APIC updates from Thomas Gleixner:
 "Rework of APIC enumeration and topology evaluation.

  The current implementation has a couple of shortcomings:

   - It fails to handle hybrid systems correctly.

   - The APIC registration code which handles CPU number assignents is
     in the middle of the APIC code and detached from the topology
     evaluation.

   - The various mechanisms which enumerate APICs, ACPI, MPPARSE and
     guest specific ones, tweak global variables as they see fit or in
     case of XENPV just hack around the generic mechanisms completely.

   - The CPUID topology evaluation code is sprinkled all over the vendor
     code and reevaluates global variables on every hotplug operation.

   - There is no way to analyze topology on the boot CPU before bringing
     up the APs. This causes problems for infrastructure like PERF which
     needs to size certain aspects upfront or could be simplified if
     that would be possible.

   - The APIC admission and CPU number association logic is
     incomprehensible and overly complex and needs to be kept around
     after boot instead of completing this right after the APIC
     enumeration.

  This update addresses these shortcomings with the following changes:

   - Rework the CPUID evaluation code so it is common for all vendors
     and provides information about the APIC ID segments in a uniform
     way independent of the number of segments (Thread, Core, Module,
     ..., Die, Package) so that this information can be computed instead
     of rewriting global variables of dubious value over and over.

   - A few cleanups and simplifcations of the APIC, IO/APIC and related
     interfaces to prepare for the topology evaluation changes.

   - Seperation of the parser stages so the early evaluation which tries
     to find the APIC address can be seperately overridden from the late
     evaluation which enumerates and registers the local APIC as further
     preparation for sanitizing the topology evaluation.

   - A new registration and admission logic which

       - encapsulates the inner workings so that parsers and guest logic
         cannot longer fiddle in it

       - uses the APIC ID segments to build topology bitmaps at
         registration time

       - provides a sane admission logic

       - allows to detect the crash kernel case, where CPU0 does not run
         on the real BSP, automatically. This is required to prevent
         sending INIT/SIPI sequences to the real BSP which would reset
         the whole machine. This was so far handled by a tedious command
         line parameter, which does not even work in nested crash
         scenarios.

       - Associates CPU number after the enumeration completed and
         prevents the late registration of APICs, which was somehow
         tolerated before.

   - Converting all parsers and guest enumeration mechanisms over to the
     new interfaces.

     This allows to get rid of all global variable tweaking from the
     parsers and enumeration mechanisms and sanitizes the XEN[PV]
     handling so it can use CPUID evaluation for the first time.

   - Mopping up existing sins by taking the information from the APIC ID
     segment bitmaps.

     This evaluates hybrid systems correctly on the boot CPU and allows
     for cleanups and fixes in the related drivers, e.g. PERF.

  The series has been extensively tested and the minimal late fallout
  due to a broken ACPI/MADT table has been addressed by tightening the
  admission logic further"

* tag 'x86-apic-2024-03-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (76 commits)
  x86/topology: Ignore non-present APIC IDs in a present package
  x86/apic: Build the x86 topology enumeration functions on UP APIC builds too
  smp: Provide 'setup_max_cpus' definition on UP too
  smp: Avoid 'setup_max_cpus' namespace collision/shadowing
  x86/bugs: Use fixed addressing for VERW operand
  x86/cpu/topology: Get rid of cpuinfo::x86_max_cores
  x86/cpu/topology: Provide __num_[cores|threads]_per_package
  x86/cpu/topology: Rename topology_max_die_per_package()
  x86/cpu/topology: Rename smp_num_siblings
  x86/cpu/topology: Retrieve cores per package from topology bitmaps
  x86/cpu/topology: Use topology logical mapping mechanism
  x86/cpu/topology: Provide logical pkg/die mapping
  x86/cpu/topology: Simplify cpu_mark_primary_thread()
  x86/cpu/topology: Mop up primary thread mask handling
  x86/cpu/topology: Use topology bitmaps for sizing
  x86/cpu/topology: Let XEN/PV use topology from CPUID/MADT
  x86/xen/smp_pv: Count number of vCPUs early
  x86/cpu/topology: Assign hotpluggable CPUIDs during init
  x86/cpu/topology: Reject unknown APIC IDs on ACPI hotplug
  x86/topology: Add a mechanism to track topology via APIC IDs
  ...
2024-03-11 15:45:55 -07:00
Armin Wolf
8debe3c129 hwmon: (dell-smm) Add XPS 9315 to fan control whitelist
A user reported that on this machine, disabling BIOS fan control
is necessary in order to change the fan speed.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Acked-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20240309212025.13758-1-W_Armin@gmx.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-03-10 12:58:18 -07:00
Billy Tsai
7e1449cd15 hwmon: (aspeed-g6-pwm-tacho): Support for ASPEED g6 PWM/Fan tach
The driver support two functions: PWM and Tachometer. The PWM feature can
handle up to 16 output ports, while the Tachometer can monitor to up to 16
input ports as well. This driver implements them by exposing two kernel
subsystems: PWM and HWMON. The PWM subsystem can be utilized alongside
existing drivers for controlling elements such as fans (pwm-fan.c),
beepers (pwm-beeper.c) and so on. Through the HWMON subsystem, the driver
provides sysfs interfaces for fan.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20240221104025.1306227-4-billy_tsai@aspeedtech.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-03-07 10:50:16 -08:00
Josua Mayer
3f003fda98 hwmon: (amc6821) add of_match table
Add of_match table for "ti,amc6821" compatible string.
This fixes automatic driver loading by userspace when using device-tree,
and if built as a module like major linux distributions do.

While devices probe just fine with i2c_device_id table, userspace can't
match the "ti,amc6821" compatible string from dt with the plain
"amc6821" device id. As a result, the kernel module can not be loaded.

Cc: stable@vger.kernel.org
Signed-off-by: Josua Mayer <josua@solid-run.com>
Link: https://lore.kernel.org/r/20240307-amc6821-of-match-v1-1-5f40464a3110@solid-run.com
[groeck: Cleaned up patch description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-03-07 09:17:40 -08:00
Ahelenia Ziemiańska
6a57a21943 Normalise "name (ad@dr)" MODULE_AUTHORs to "name <ad@dr>"
Found with git grep 'MODULE_AUTHOR(".*([^)]*@'
Fixed with
  sed -i '/MODULE_AUTHOR(".*([^)]*@/{s/ (/ </g;s/)"/>"/;s/)and/> and/}' \
    $(git grep -l 'MODULE_AUTHOR(".*([^)]*@')

Also:
  in drivers/media/usb/siano/smsusb.c normalise ", INC" to ", Inc";
     this is what every other MODULE_AUTHOR for this company says,
     and it's what the header says
  in drivers/sbus/char/openprom.c normalise a double-spaced separator;
     this is clearly copied from the copyright header,
     where the names are aligned on consecutive lines thusly:
      * Linux/SPARC PROM Configuration Driver
      * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu)
      * Copyright (C) 1996 Eddie C. Dost  (ecd@skynet.be)
     but the authorship branding is single-line

Link: https://lkml.kernel.org/r/mk3geln4azm5binjjlfsgjepow4o73domjv6ajybws3tz22vb3@tarta.nabijaczleweli.xyz
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-03-06 13:07:39 -08:00
Krzysztof Kozlowski
5b1d7a0f90 hwmon: (sis5595) drop unused DIV_TO_REG function
'DIV_TO_REG' function is not used:

  sis5595.c:159:18: error: unused function 'DIV_TO_REG' [-Werror,-Wunused-function]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240225202841.60740-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:47 -08:00
Guenter Roeck
cb7222997e hwmon: (pmbus/ir38064) Use PMBUS_REGULATOR_ONE to declare regulator
If a chip only provides a single regulator, it should be named 'vout'
and not 'vout0'. Declare regulator using PMBUS_REGULATOR_ONE() to make
that happen.

Cc: Conor Dooley <conor@kernel.org>
Cc: Naresh Solanki <naresh.solanki@9elements.com>
Cc: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240223-harmless-covenant-9cd3d4f1cfd2@spud
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:46 -08:00
Guenter Roeck
8f832d23ea hwmon: (pmbus/lm25066) Use PMBUS_REGULATOR_ONE to declare regulator
If a chip only provides a single regulator, it should be named 'vout'
and not 'vout0'. Declare regulator using PMBUS_REGULATOR_ONE() to make
that happen.

Cc: Conor Dooley <conor@kernel.org>
Cc: Naresh Solanki <naresh.solanki@9elements.com>
Cc: Zev Weiss <zev@bewilderbeest.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240223-player-buckskin-01405c5889c4@spud
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:46 -08:00
Guenter Roeck
8be143b978 hwmon: (pmbus/tda38640) Use PMBUS_REGULATOR_ONE to declare regulator
If a chip only provides a single regulator, it should be named 'vout'
and not 'vout0'. Declare regulator using PMBUS_REGULATOR_ONE() to make
that happen.

Cc: Conor Dooley <conor@kernel.org>
Cc: Naresh Solanki <naresh.solanki@9elements.com>
Cc: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240223-catnap-companion-c42fdd8ad110@spud
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:46 -08:00
Nuno Sa
ec823656c1 hwmon: (axi-fan-control) Make use of dev_err_probe()
Use dev_err_probe() to slightly simplify printing errors during probe.
No functional changes intended.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240214-axi-fan-control-no-of-v1-3-43ca656fe2e3@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:46 -08:00
Nuno Sa
0b5f91d47d hwmon: (axi-fan-control) Make use of sysfs_emit()
Use sysfs_emit() instead of directly call sprintf().

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240214-axi-fan-control-no-of-v1-2-43ca656fe2e3@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:46 -08:00
Nuno Sa
1b5239f70f hwmon: (axi-fan-control) Use device firmware agnostic API
Don't directly use OF and use device property APIs. In addition, this
makes the probe() code neater and also allow us to move the
of_device_id table to it's natural place.

While at it, make sure to explicitly include mod_devicetable.h for the
of_device_id table.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240214-axi-fan-control-no-of-v1-1-43ca656fe2e3@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:46 -08:00
Sebastian Kranz
692cf83bc3 hwmon: (oxp-sensors) Add support for Ayaneo Air Plus 7320u.
Add support for handheld AYANEO AIR Plus with the same EC registers
to add proper fan control.

Functionality was tested successfully.

Signed-off-by: Sebastian Kranz <tklightforce@googlemail.com>
Link: https://lore.kernel.org/r/20240209090157.3232-1-tklightforce@googlemail.com
[groeck: Fixed up commit message]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:46 -08:00
Javier Carrasco
efd49b8eef hwmon: (chipcap2) fix return path in cc2_request_alarm_irqs()
The return path can be improved by returning upon first failure. The
current implementation would try to register the second interrupt even
if the first one failed, which is unnecessary.

Moreover, if no irqs are available, the return value should be zero
(the driver supports the use case with no interrupts). Currently the
initial value is unassigned and that may lead to returning an unknown
value if stack variables are not automatically set to zero and no irqs
were provided.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-hwmon/294e4634-89d4-415e-a723-b208d8770d7c@gmail.com/T/#t
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240207-chipcap2_init_vars-v1-2-08cafe43e20e@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:42 -08:00
Javier Carrasco
f16fb6d23b hwmon: (chipcap2) fix uninitialized variable in cc2_get_reg_val()
The reg_val variable in cc2_get_reg_val() might be used without a known
value if cc2_read_reg() fails. That leads to a useless data conversion
because the returned error means the read operation failed and the data is
not relevant.

That makes its initial value irrelevant as well, so skip the data
conversion instead. If no error happens, a value is assigned to reg_val
and the data conversion is required.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-hwmon/294e4634-89d4-415e-a723-b208d8770d7c@gmail.com/T/#t
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240207-chipcap2_init_vars-v1-1-08cafe43e20e@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:38 -08:00
Cosmo Chou
1b2ca93cd0 hwmon: Add driver for Astera Labs PT5161L retimer
This driver implements support for temperature monitoring of Astera Labs
PT5161L series PCIe retimer chips.

This driver implementation originates from the CSDK available at
Link: https://github.com/facebook/openbmc/tree/helium/common/recipes-lib/retimer-v2.14
The communication protocol utilized is based on the I2C/SMBus standard.

Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
Link: https://lore.kernel.org/r/20240206125420.3884300-2-chou.cosmo@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Zhang Rui
1a793caf6f hwmon: (coretemp) Use dynamic allocated memory for core temp_data
The total memory needed for saving per core temperature data depends on
the number of cores in a package. Using static allocated memory wastes
memories on systems with low per package core count.

Improve the code to use dynamic allocated memory so that it can be
improved further when per package core count information becomes
available.

No functional change intended.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Link: https://lore.kernel.org/r/20240202092144.71180-12-rui.zhang@intel.com
[groeck: Fixed continuation line alignment]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Zhang Rui
18b24a5f9c hwmon: (coretemp) Remove redundant temp_data->is_pkg_data
temp_data->index saves the index in pdata->core_data[]. It is not used
by package temp_data.

Use temp_data->index as the indicator of package temp_data and remove
redundant temp_data->is_pkg_data.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Link: https://lore.kernel.org/r/20240202092144.71180-11-rui.zhang@intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Zhang Rui
326241f71f hwmon: (coretemp) Split package temp_data and core temp_data
Saving package temp_data and core temp_data in one array with different
offsets is fragile.

Split them and clean up crabbed maths and macros. This also fixes a
problem that pdata->core_data[0] was never used.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Link: https://lore.kernel.org/r/20240202092144.71180-10-rui.zhang@intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Zhang Rui
b0b01414a2 hwmon: (coretemp) Abstract core_temp helpers
coretemp driver has an obscure and fragile logic for handling package
and core temperature data.

Place the logic in newly introduced helpers for further optimizations.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Link: https://lore.kernel.org/r/20240202092144.71180-9-rui.zhang@intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Zhang Rui
87eb801925 hwmon: (coretemp) Remove redundant pdata->cpu_map[]
pdata->cpu_map[] saves the mapping between cpu core id and the index in
pdata->core_data[]. This is used to find the temp_data structure using
cpu_core_id, by traversing the pdata->cpu_map[] array. But the same goal
can be achieved by traversing the pdata->core_temp[] array directly.

Remove redundant pdata->cpu_map[].

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Link: https://lore.kernel.org/r/20240202092144.71180-8-rui.zhang@intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Zhang Rui
18d8f55833 hwmon: (coretemp) Replace sensor_device_attribute with device_attribute
Replace sensor_device_attribute with device_attribute because
sensor_device_attribute->index is no longer used.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Link: https://lore.kernel.org/r/20240202092144.71180-7-rui.zhang@intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Zhang Rui
25f8e01baa hwmon: (coretemp) Remove unnecessary dependency of array index
When sensor_device_attribute pointer is available, use container_of() to
get the temp_data address.

This removes the unnecessary dependency of cached index in
pdata->core_data[].

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Link: https://lore.kernel.org/r/20240202092144.71180-6-rui.zhang@intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Zhang Rui
c8c2074020 hwmon: (coretemp) Introduce enum for attr index
Introduce enum coretemp_attr_index to better describe the index of each
sensor attribute.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Link: https://lore.kernel.org/r/20240202092144.71180-5-rui.zhang@intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Aleksa Savic
ed3e03790c hwmon: Add driver for ASUS ROG RYUJIN II 360 AIO cooler
This driver exposes hardware sensors of the ASUS ROG RYUJIN II 360
all-in-one CPU liquid cooler, which communicates through a proprietary
USB HID protocol. Report offsets were initially discovered in [1] by
Florian Freudiger.

Available sensors are pump, internal and external
(controller) fan speed in RPM, their duties in PWM, as well as
coolant temperature.

Attaching external fans to the controller is optional and allows them
to be controlled from the device. If not connected, the fan-related
sensors will report zeroes. The controller is a separate hardware unit
that comes bundled with the AIO and connects to it to allow fan control.

The addressable LCD screen is not supported in this
driver and should be controlled through userspace tools.

[1]: https://github.com/liquidctl/liquidctl/pull/653

Tested-by: Florian Freudiger <florian.freudiger@proton.me>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20240108094453.22986-1-savicaleksa83@gmail.com
[groeck: Add HID dependency]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Aleksa Savic
f3b4b146eb hwmon: Add driver for NZXT Kraken X and Z series AIO CPU coolers
This driver enables hardware monitoring support for NZXT Kraken
X53/X63/X73 and Z53/Z63/Z73 all-in-one CPU liquid coolers.

All models expose liquid temperature and pump speed (in RPM), as well as
PWM control (natively only through a temp-PWM curve, but the driver also
emulates fixed PWM control on top of that). The Z-series models
additionally expose the speed and duty of an optionally connected fan,
with the same PWM control capabilities.

Pump and fan duty control mode can be set through pwm[1-2]_enable,
where 1 is for the manual control mode and 2 is for the liquid temp
to PWM curve mode. Writing a 0 disables control of the channel through
the driver after setting its duty to 100%. As it is not possible to query
the device for the active mode, the driver keeps track of it.

The temperature of the curves relates to the fixed [20-59] C range, per
device limitations, and correlating to the detected liquid temperature.
Only PWM values (ranging from 0-255) can be set.

The addressable RGB LEDs and LCD screen, included only on Z-series models,
are not supported in this driver.

Co-developed-by: Jonas Malaco <jonas@protocubo.io>
Signed-off-by: Jonas Malaco <jonas@protocubo.io>
Co-developed-by: Yury Zhuravlev <stalkerg@gmail.com>
Signed-off-by: Yury Zhuravlev <stalkerg@gmail.com>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20240129111932.368232-1-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Javier Carrasco
3af350929e hwmon: Add support for Amphenol ChipCap 2
The Amphenol ChipCap 2 is a capacitive polymer humidity and temperature
sensor with an integrated EEPROM and minimum/maximum humidity alarms.

All device variants offer an I2C interface and depending on the part
number, two different output modes:
- CC2D: digital output
- CC2A: analog (PDM) output

This driver adds support for the digital variant (CC2D part numbers),
which includes the following part numbers:
- non-sleep measurement mode (CC2D23, CC2D25, CC2D33, CC2D35)
- sleep measurement mode (CC2D23S, CC2D25S, CC2D33S, CC2D35S)

The Chipcap 2 EEPROM can be accessed to configure a series of parameters
like the minimum/maximum humidity alarm threshold and hysteresis. The
EEPROM is only accessible in the command window after a power-on reset.
The default window lasts 10 ms if no Start_CM command is sent. After the
command window is finished (either after the mentioned timeout of after
a Start_NOM command is sent), the device enters the normal operation
mode and makes a first measurement automatically.

Unfortunately, the device does not provide any hardware or software
reset and therefore the driver must trigger power cycles to enter the
command mode. A dedicated, external regulator is required for that.

This driver keeps the device off until a measurement or access to the
EEPROM is required, making use of the first automatic measurement to
avoid different code paths for sleep and non-sleep devices.

The minimum and maximum humidity alarms are configured with two
registers per alarm: one stores the alarm threshold and the other one
keeps the value that turns off the alarm. The alarm signals are only
updated when a measurement is carried out.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240130-topic-chipcap2-v6-5-260bea05cf9b@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Javier Carrasco
5f85c4d10e hwmon: (core) Add support for humidity min/max alarm
Add min_alarm and max_alarm attributes for humidityX to support devices
that can generate these alarms.
Such attributes already exist for other magnitudes such as tempX.

Tested with a ChipCap 2 temperature-humidity sensor.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240130-topic-chipcap2-v6-2-260bea05cf9b@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:37 -08:00
Bo Liu
cac78418e2 hwmon: (tmp401) convert to use maple tree register cache
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Link: https://lore.kernel.org/r/20240202072235.41614-1-liubo03@inspur.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:36 -08:00
Bo Liu
3d8e02bda1 hwmon: (sch5627) convert to use maple tree register cache
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Link: https://lore.kernel.org/r/20240202072039.41419-1-liubo03@inspur.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:36 -08:00
Bo Liu
23c7029f37 hwmon: (nct7802) convert to use maple tree register cache
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Link: https://lore.kernel.org/r/20240202072007.41316-1-liubo03@inspur.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:36 -08:00
Bo Liu
7a04f015d4 hwmon: (max31760) convert to use maple tree register cache
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Link: https://lore.kernel.org/r/20240202071927.41213-1-liubo03@inspur.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:36 -08:00
Bo Liu
6c224da4d7 hwmon: (lm83) convert to use maple tree register cache
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Link: https://lore.kernel.org/r/20240202071800.41113-1-liubo03@inspur.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:36 -08:00
Bo Liu
f8fec5f317 hwmon: (jc42) convert to use maple tree register cache
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Link: https://lore.kernel.org/r/20240202071628.40990-1-liubo03@inspur.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:36 -08:00