Commit graph

3 commits

Author SHA1 Message Date
Harshit Mogalapalli
97aab852c4 hwmon: gigabyte_waterforce: Fix locking bug in waterforce_get_status()
Goto 'unlock_and_return' for unlocking before returning on the error
path.

Fixes: d5939a793693 ("hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20240122154952.2851934-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-01-26 10:39:53 -08:00
Aleksa Savic
41c71105a8 hwmon: (gigabyte_waterforce) Mark status report as received under a spinlock
Through hidraw, userspace can cause a status report to be sent
from the device. The parsing in waterforce_raw_event() may happen in
parallel to a waterforce_get_status() 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() call in waterforce_raw_event()
to prevent race issues.

Fixes: d5939a793693 ("hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers")
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20231219143620.22179-1-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-01-08 07:27:27 -08:00
Aleksa Savic
42ac68e3d4 hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers
This driver exposes hardware sensors of the Gigabyte AORUS Waterforce
all-in-one CPU liquid coolers, which communicate through a proprietary
USB HID protocol. Report offsets were initially discovered in [1] and
confirmed by me on a Waterforce X240 by observing the sent reports from
the official software.

Available sensors are pump and fan speed in RPM, as well as coolant
temperature. Also available through debugfs is the firmware version.

Attaching a fan is optional and allows it to be controlled from the
device. If it's not connected, the fan-related sensors will report
zeroes.

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

[1]: https://github.com/liquidctl/liquidctl/issues/167

Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20231207122402.107032-1-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-01-02 08:44:57 -08:00