summaryrefslogtreecommitdiff
path: root/drivers/hwmon/corsair-psu.c
AgeCommit message (Collapse)AuthorFilesLines
2023-12-08hwmon: (corsair-psu) Fix probe when built-inArmin Wolf1-1/+17
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>
2023-06-24hwmon: (corsair-psu) update Series 2022 and 2023 supportWilken Gottwalt1-3/+6
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>
2023-06-23hwmon: (corsair-psu) various cleanupsWilken Gottwalt1-12/+11
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>
2023-06-22hwmon: (corsair-psu) add support for reading PWM values and modeWilken Gottwalt1-1/+61
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>
2023-04-19hwmon: corsair: constify pointers to hwmon_channel_infoKrzysztof Kozlowski1-1/+1
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>
2022-10-22hwmon: (corsair-psu) Add USB id of the new HX1500i psuWilken Gottwalt1-0/+1
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>
2022-10-17hwmon: (corsair-psu) fix typo in USB id descriptionWilken Gottwalt1-1/+1
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>
2022-10-03hwmon: (corsair-psu) add USB id of new revision of the HX1000i psuWilken Gottwalt1-1/+2
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>
2022-09-19hwmon: (corsair-psu) add reporting of rail mode via debugfsWilken Gottwalt1-1/+28
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>
2021-11-15hwmon: (corsair-psu) fix plain integer used as NULL pointerWilken Gottwalt1-1/+1
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>
2021-06-09hwmon: (corsair-psu) fix suspend behaviorWilken Gottwalt1-0/+14
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>
2021-05-10hwmon: (corsair-psu) Remove unneeded semicolonsWan Jiabing1-2/+2
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>
2021-04-20hwmon: (corsair-psu) add support for critical valuesWilken Gottwalt1-55/+270
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>
2021-04-20hwmon: (corsair-psu) Update calculation of LINEAR11 valuesWilken Gottwalt1-22/+8
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>
2020-12-03hwmon: (corsair-psu) Fix fan rpm calculationWilken Gottwalt1-6/+1
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>
2020-12-03hwmon: (corsair-psu) fix unintentional sign extension issueColin Ian King1-1/+1
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>
2020-12-03hwmon: add Corsair PSU HID controller driverWilken Gottwalt1-0/+605
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>