History log of /linux-master/drivers/hwmon/corsair-psu.c
Revision Date Author Comments
# 307004e8 07-Dec-2023 Armin Wolf <W_Armin@gmx.de>

hwmon: (corsair-psu) Fix probe when built-in

It seems that when the driver is built-in, the HID bus is
initialized after the driver is loaded, which whould cause
module_hid_driver() to fail.
Fix this by registering the driver after the HID bus using
late_initcall() in accordance with other hwmon HID drivers.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20231207210723.222552-1-W_Armin@gmx.de
[groeck: Dropped "compile tested" comment; the patch has been tested
but the tester did not provide a Tested-by: tag]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 741ed085 24-Jun-2023 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) update Series 2022 and 2023 support

The series 2022/2023 reports slightly longer vendor/product strings
and shares USB ids. Technically the reply size is the USB HID packet
size (64 bytes) but all the supported commands do not use more than 8
bytes and replies reporting back strings do not use more then 24 bytes
(vendor and product are in one string in the newer devices now). The
rest of the reply is always filled with '\0'. Also update comments
and documentation accordingly.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/ZJbB72CAPmLflhHG@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# b54c4b02 23-Jun-2023 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) various cleanups

Fix some typos, adjust documentation and comments to current state of
knowledge and update coding style to be more uniform.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/ZJWf3H972hGgLK-8@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 0d67bbc4 22-Jun-2023 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) add support for reading PWM values and mode

Add support for reading PWM values and mode,
and update documentation accordingly.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/ZJSASByXpzoZ0XyH@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 42bd7a59 06-Apr-2023 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

hwmon: corsair: constify pointers to hwmon_channel_info

Statically allocated array of pointed to hwmon_channel_info can be made
const for safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 5619c660 08-Oct-2022 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) Add USB id of the new HX1500i psu

Also update the documentation accordingly.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/Y0FghqQCHG/cX5Jz@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# b6291023 03-Oct-2022 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) fix typo in USB id description

Fix spelling mistake (Corsaur -> Corsair).

Fixes: 0cf46a653bda ("hwmon: (corsair-psu) add USB id of new revision of the HX1000i psu")
Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/Yzql13NOvQLlrye1@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 0cf46a65 02-Oct-2022 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) add USB id of new revision of the HX1000i psu

Also updates the documentation accordingly.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/YznOUQ7Pijedu0NW@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# eb12f548 11-Aug-2022 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) add reporting of rail mode via debugfs

Add reporting if the PSU is running in single or multi rail mode via
ocpmode debugfs entry. Also update the documentation and driver comments
accordingly.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/YvS9PZKr0xqFqJny@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 83832265 12-Nov-2021 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) fix plain integer used as NULL pointer

sparse warnings: (new ones prefixed by >>)
>> drivers/hwmon/corsair-psu.c:536:82: sparse: sparse: Using plain
integer as NULL pointer

Fixes: d115b51e0e56 ("hwmon: add Corsair PSU HID controller driver")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/YY9hAL8MZEQYLYPf@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 7656cd21 03-Jun-2021 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) fix suspend behavior

During standby some PSUs turn off the microcontroller. A re-init is
required during resume or the microcontroller stays unresponsive.

Fixes: d115b51e0e56 ("hwmon: add Corsair PSU HID controller driver")
Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/YLjCJiVtu5zgTabI@monster.powergraphx.local
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 726c945a 26-Apr-2021 Wan Jiabing <wanjiabing@vivo.com>

hwmon: (corsair-psu) Remove unneeded semicolons

Fix the following coccicheck warning:

./drivers/hwmon/corsair-psu.c:379:2-3: Unneeded semicolon

Remove unneeded semicolons.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20210427044219.7799-1-wanjiabing@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# c2d5f273 18-Mar-2021 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) add support for critical values

Adds support for reading the critical values of the temperature sensors
and the rail sensors (voltage and current) once and caches them. Updates
the naming of the constants following a more clear scheme. Also updates
the documentation and fixes some typos. Updates is_visible and ops_read
functions to be more readable.

The new sensors output of a Corsair HX850i will look like this:
corsairpsu-hid-3-1
Adapter: HID adapter
v_in: 230.00 V
v_out +12v: 12.14 V (crit min = +8.41 V, crit max = +15.59 V)
v_out +5v: 5.03 V (crit min = +3.50 V, crit max = +6.50 V)
v_out +3.3v: 3.30 V (crit min = +2.31 V, crit max = +4.30 V)
psu fan: 0 RPM
vrm temp: +46.2°C (crit = +70.0°C)
case temp: +39.8°C (crit = +70.0°C)
power total: 152.00 W
power +12v: 108.00 W
power +5v: 41.00 W
power +3.3v: 5.00 W
curr +12v: 9.00 A (crit max = +85.00 A)
curr +5v: 8.31 A (crit max = +40.00 A)
curr +3.3v: 1.62 A (crit max = +40.00 A)

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/YFNg6vGk3sQmyqgB@monster.powergraphx.local
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 918f2210 27-Feb-2021 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) Update calculation of LINEAR11 values

Changes the way how LINEAR11 values are calculated. The new method
increases the precision of 2-3 digits.

old method:
corsairpsu-hid-3-1
Adapter: HID adapter
v_in: 230.00 V
v_out +12v: 12.00 V
v_out +5v: 5.00 V
v_out +3.3v: 3.00 V
psu fan: 0 RPM
vrm temp: +44.0°C
case temp: +37.0°C
power total: 152.00 W
power +12v: 112.00 W
power +5v: 38.00 W
power +3.3v: 5.00 W
curr in: N/A
curr +12v: 9.00 A
curr +5v: 7.00 A
curr +3.3v: 1000.00 mA

new method:
corsairpsu-hid-3-1
Adapter: HID adapter
v_in: 230.00 V
v_out +12v: 12.16 V
v_out +5v: 5.01 V
v_out +3.3v: 3.30 V
psu fan: 0 RPM
vrm temp: +44.5°C
case temp: +37.8°C
power total: 148.00 W
power +12v: 108.00 W
power +5v: 37.00 W
power +3.3v: 4.50 W
curr in: N/A
curr +12v: 9.25 A
curr +5v: 7.50 A
curr +3.3v: 1.50 A

Co-developed-by: Jack Doan <me@jackdoan.com>
Signed-off-by: Jack Doan <me@jackdoan.com>
Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/YDoSMqFbgoTXyoru@monster.powergraphx.local
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 72969073 13-Nov-2020 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: (corsair-psu) Fix fan rpm calculation

The correct fan rpm value is also a LINEAR11 value but without a factor.
Verified by using the fan test button on the psu to let the fan spin up
to maximum for some seconds.

Fixes: 933222c98445 ("hwmon: (corsair-psu) fix unintentional sign extension issue")
Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/20201113121954.GA8488@monster.powergraphx.local
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 90673f71 05-Nov-2020 Colin Ian King <colin.king@canonical.com>

hwmon: (corsair-psu) fix unintentional sign extension issue

The shifting of the u8 integer data[3] by 24 bits to the left will
be promoted to a 32 bit signed int and then sign-extended to a
long. In the event that the top bit of data[3] is set then all
then all the upper 32 bits of a 64 bit long end up as also being
set because of the sign-extension. Fix this by casting data[3] to
a long before the shift.

Addresses-Coverity: ("Unintended sign extension")
Fixes: ce15cd2cee8b ("hwmon: add Corsair PSU HID controller driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20201105115019.41735-1-colin.king@canonical.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# d115b51e 27-Oct-2020 Wilken Gottwalt <wilken.gottwalt@posteo.net>

hwmon: add Corsair PSU HID controller driver

The Corsair digital power supplies of the series RMi, HXi and AXi include
a small micro-controller with a lot of sensors attached. The sensors can
be accessed by an USB connector from the outside.

This micro-controller provides the data by a simple proprietary USB HID
protocol. The data consist of temperatures, current and voltage levels,
power usage, uptimes, fan speed and some more. It is also possible to
configure the PSU (fan mode, mono/multi-rail, over current protection).

This driver provides access to the sensors/statistics of the RMi and HXi
series power supplies. It does not support configuring these devices,
because there would be many ways to misconfigure or even damage the PSU.

This patch adds:
- hwmon driver corsair-psu
- hwmon documentation
- updates MAINTAINERS

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/20201027131710.GA253280@monster.powergraphx.local
Signed-off-by: Guenter Roeck <linux@roeck-us.net>