hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers
Aleksa Savic
maintainerPATCH 1/1 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
--- Documentation/hwmon/gigabyte_waterforce.rst | 47 +++ MAINTAINERS | 7 + drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/gigabyte_waterforce.c | 439 ++++++++++++++++++++ 5 files changed, 504 insertions(+) create mode 100644 Documentation/hwmon/gigabyte_waterforce.rst create mode 100644 drivers/hwmon/gigabyte_waterforce.c
Documentation/hwmon/gigabyte_waterforce.rst new file +47 -0
@@ -0,0 +1,47 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Kernel driver gigabyte_waterforce +================================= + +Supported devices: + +* Gigabyte AORUS WATERFORCE X240 +* Gigabyte AORUS WATERFORCE X280 +* Gigabyte AORUS WATERFORCE X360 + +Author: Aleksa Savic + +Description +----------- + +This driver enables hardware monitoring support for the listed Gigabyte Waterforce +all-in-one CPU liquid coolers. 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. + +Usage notes +----------- + +As these are USB HIDs, the driver can be loaded automatically by the kernel and +supports hot swapping. + +Sysfs entries +------------- + +=========== ============================================= +fan1_input Fan speed (in rpm) +fan2_input Pump speed (in rpm) +temp1_input Coolant temperature (in millidegrees Celsius) +=========== ============================================= + +Debugfs entries +--------------- + +================ ======================= +firmware_version Device firmware version +================ =======================
MAINTAINERS +7 -0
@@ -8795,6 +8795,13 @@ F: Documentation/filesystems/gfs2* F: fs/gfs2/ F: include/uapi/linux/gfs2_ondisk.h +GIGABYTE WATERFORCE SENSOR DRIVER +M: Aleksa Savic <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/hwmon/gigabyte_waterforce.rst +F: drivers/hwmon/gigabyte_waterforce.c + GIGABYTE WMI DRIVER M: Thomas Weißschuh <[email protected]> L: [email protected]
drivers/hwmon/Kconfig +10 -0
@@ -663,6 +663,16 @@ config SENSORS_FTSTEUTATES This driver can also be built as a module. If so, the module will be called ftsteutates. +config SENSORS_GIGABYTE_WATERFORCE + tristate "Gigabyte Waterforce X240/X280/X360 AIO CPU coolers" + depends on USB_HID + help + If you say yes here you get support for hardware monitoring for the + Gigabyte Waterforce X240/X280/X360 all-in-one CPU liquid coolers. + + This driver can also be built as a module. If so, the module + will be called gigabyte_waterforce. + config SENSORS_GL518SM tristate "Genesys Logic GL518SM" depends on I2C
drivers/hwmon/Makefile +1 -0
@@ -80,6 +80,7 @@ obj-$(CONFIG_SENSORS_FSCHMD) += fschmd.o obj-$(CONFIG_SENSORS_FTSTEUTATES) += ftsteutates.o obj-$(CONFIG_SENSORS_G760A) += g760a.o obj-$(CONFIG_SENSORS_G762) += g762.o +obj-$(CONFIG_SENSORS_GIGABYTE_WATERFORCE) += gigabyte_waterforce.o obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o obj-$(CONFIG_SENSORS_GSC) += gsc-hwmon.o
drivers/hwmon/gigabyte_waterforce.c new file +439 -0
439 lines not on this page · raw message
Signature · 1 line
2.41.0
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Aleksa,
kernel test robot noticed the following build warnings:
[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on linus/master v6.6-rc7 next-20231026] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Aleksa-Savic/hwmon-Add-driver-for-Gigabyte-AORUS-Waterforce-AIO-coolers/20231020-210452 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next patch link: https://lore.kernel.org/r/20231020130212.8919-1-savicaleksa83%40gmail.com patch subject: [PATCH] hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers reproduce: (https://download.01.org/0day-ci/archive/20231027/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> Documentation/hwmon/gigabyte_waterforce.rst: WARNING: document isn't included in any toctree
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Aleksa,
kernel test robot noticed the following build warnings:
[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on linus/master v6.6-rc7 next-20231027] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Aleksa-Savic/hwmon-Add-driver-for-Gigabyte-AORUS-Waterforce-AIO-coolers/20231020-210452 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next patch link: https://lore.kernel.org/r/20231020130212.8919-1-savicaleksa83%40gmail.com patch subject: [PATCH] hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20231030/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231030/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/hwmon/gigabyte_waterforce.c:130:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
130 | if (!time_after(jiffies, priv->updated + msecs_to_jiffies(STATUS_VALIDITY))) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/gigabyte_waterforce.c:155:7: note: uninitialized use occurs here
155 | if (ret < 0)
| ^~~
drivers/hwmon/gigabyte_waterforce.c:130:3: note: remove the 'if' if its condition is always false
130 | if (!time_after(jiffies, priv->updated + msecs_to_jiffies(STATUS_VALIDITY))) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131 | /* Data is up to date */
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132 | goto unlock_and_return;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133 | }
| ~~~~~~~~~~~~~~~~~
drivers/hwmon/gigabyte_waterforce.c:127:9: note: initialize the variable 'ret' to silence this warning
127 | int ret;
| ^
| = 01 warning generated.
vim +130 drivers/hwmon/gigabyte_waterforce.c
124
125 static int waterforce_get_status(struct waterforce_data *priv)
126 {
127 int ret;
128
129 if (!mutex_lock_interruptible(&priv->status_report_request_mutex)) {
> 130 if (!time_after(jiffies, priv->updated + msecs_to_jiffies(STATUS_VALIDITY))) { 131 /* Data is up to date */
132 goto unlock_and_return;
133 }
134
135 /*
136 * Disable raw event parsing for a moment to safely reinitialize the
137 * completion. Reinit is done because hidraw could have triggered
138 * the raw event parsing and marked the priv->status_report_received
139 * completion as done.
140 */
141 spin_lock_bh(&priv->status_report_request_lock);
142 reinit_completion(&priv->status_report_received);
143 spin_unlock_bh(&priv->status_report_request_lock);
144
145 /* Send command for getting status */
146 ret = waterforce_write_expanded(priv, get_status_cmd, GET_STATUS_CMD_LENGTH);
147 if (ret < 0)
148 return ret;
149
150 if (wait_for_completion_interruptible_timeout
151 (&priv->status_report_received, msecs_to_jiffies(STATUS_VALIDITY)) <= 0)
152 ret = -ENODATA;
153 unlock_and_return:
154 mutex_unlock(&priv->status_report_request_mutex);
155 if (ret < 0)
156 return ret;
157 } else {
158 return -ENODATA;
159 }
160
161 return 0;
162 }
163
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Aleksa Savic
maintainerQuoted 19 lines · Aleksa Savic
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 <[email protected]>
Quoted 9 lines
--- Documentation/hwmon/gigabyte_waterforce.rst | 47 +++ MAINTAINERS | 7 + drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/gigabyte_waterforce.c | 439 ++++++++++++++++++++ 5 files changed, 504 insertions(+) create mode 100644 Documentation/hwmon/gigabyte_waterforce.rst create mode 100644 drivers/hwmon/gigabyte_waterforce.c
Hi Guenter,
Any thoughts on the patch? I'll fix the issues kernel bot reported in v2.
Thanks,
Aleksa
Guenter Roeck
maintainerQuoted 30 lines · Aleksa Savic
Quoted 26 lines · Aleksa Savic
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 <[email protected]>--- Documentation/hwmon/gigabyte_waterforce.rst | 47 +++ MAINTAINERS | 7 + drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/gigabyte_waterforce.c | 439 ++++++++++++++++++++ 5 files changed, 504 insertions(+)Quoted 2 lines
create mode 100644
Documentation/hwmon/gigabyte_waterforce.rstcreate mode 100644drivers/hwmon/gigabyte_waterforce.c
Quoted 5 lines
Hi Guenter,
Any thoughts on the patch? I'll fix the issues kernel bot reported in v2.
I was waiting for that. In general, I am too busy to review patches if 0-day reports a problem, and wait for those to be resolved.
Guenter
Aleksa Savic
maintainerQuoted 6 lines · Guenter Roeck
I was waiting for that. In general, I am too busy to review patches if 0-day reports a problem, and wait for those to be resolved.
Guenter
Ah, fair enough. I was hesitant to send a v2 outright, but will do that soon and know for the future.
Thanks,
Aleksa