Skip to content

Commit 53e68c2

Browse files
amezingroeck
authored andcommitted
hwmon: add driver for NZXT RGB&Fan Controller/Smart Device v2.
This driver implements monitoring and control of fans plugged into the device. Besides typical speed monitoring and PWM duty cycle control, voltage and current are reported for every fan. The device also has 2 connectors for RGB LEDs, support for them isn't implemented (mainly because there is no standardized sysfs interface). Also, the device has a noise sensor, but the sensor seems to be completely useless (and very imprecise), so support for it isn't implemented too. The driver coexists with userspace tools that access the device through hidraw interface with no known issues. The driver has been tested on x86_64, built in and as a module. Some changes/improvements were suggested by Jonas Malaco. Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com> Link: https://lore.kernel.org/r/20211031033058.151014-1-mezin.alexander@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 1e7c94b commit 53e68c2

6 files changed

Lines changed: 910 additions & 0 deletions

File tree

Documentation/hwmon/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Hardware Monitoring Kernel Drivers
154154
nsa320
155155
ntc_thermistor
156156
nzxt-kraken2
157+
nzxt-smart2
157158
occ
158159
pc87360
159160
pc87427
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.. SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
Kernel driver nzxt-smart2
4+
=========================
5+
6+
Supported devices:
7+
8+
- NZXT RGB & Fan controller
9+
- NZXT Smart Device v2
10+
11+
Description
12+
-----------
13+
14+
This driver implements monitoring and control of fans plugged into the device.
15+
Besides typical speed monitoring and PWM duty cycle control, voltage and current
16+
is reported for every fan.
17+
18+
The device also has two connectors for RGB LEDs; support for them isn't
19+
implemented (mainly because there is no standardized sysfs interface).
20+
21+
Also, the device has a noise sensor, but the sensor seems to be completely
22+
useless (and very imprecise), so support for it isn't implemented too.
23+
24+
Usage Notes
25+
-----------
26+
27+
The device should be autodetected, and the driver should load automatically.
28+
29+
If fans are plugged in/unplugged while the system is powered on, the driver
30+
must be reloaded to detect configuration changes; otherwise, new fans can't
31+
be controlled (`pwm*` changes will be ignored). It is necessary because the
32+
device has a dedicated "detect fans" command, and currently, it is executed only
33+
during initialization. Speed, voltage, current monitoring will work even without
34+
reload. As an alternative to reloading the module, a userspace tool (like
35+
`liquidctl`_) can be used to run "detect fans" command through hidraw interface.
36+
37+
The driver coexists with userspace tools that access the device through hidraw
38+
interface with no known issues.
39+
40+
.. _liquidctl: https://github.com/liquidctl/liquidctl
41+
42+
Sysfs entries
43+
-------------
44+
45+
======================= ========================================================
46+
fan[1-3]_input Fan speed monitoring (in rpm).
47+
curr[1-3]_input Current supplied to the fan (in milliamperes).
48+
in[0-2]_input Voltage supplied to the fan (in millivolts).
49+
pwm[1-3] Controls fan speed: PWM duty cycle for PWM-controlled
50+
fans, voltage for other fans. Voltage can be changed in
51+
9-12 V range, but the value of the sysfs attribute is
52+
always in 0-255 range (1 = 9V, 255 = 12V). Setting the
53+
attribute to 0 turns off the fan completely.
54+
pwm[1-3]_enable 1 if the fan can be controlled by writing to the
55+
corresponding pwm* attribute, 0 otherwise. The device
56+
can control only the fans it detected itself, so the
57+
attribute is read-only.
58+
pwm[1-3]_mode Read-only, 1 for PWM-controlled fans, 0 for other fans
59+
(or if no fan connected).
60+
update_interval The interval at which all inputs are updated (in
61+
milliseconds). The default is 1000ms. Minimum is 250ms.
62+
======================= ========================================================

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13805,6 +13805,13 @@ S: Maintained
1380513805
F: Documentation/hwmon/nzxt-kraken2.rst
1380613806
F: drivers/hwmon/nzxt-kraken2.c
1380713807

13808+
NZXT-SMART2 HARDWARE MONITORING DRIVER
13809+
M: Aleksandr Mezin <mezin.alexander@gmail.com>
13810+
L: linux-hwmon@vger.kernel.org
13811+
S: Maintained
13812+
F: Documentation/hwmon/nzxt-smart2.rst
13813+
F: drivers/hwmon/nzxt-smart2.c
13814+
1380813815
OBJAGG
1380913816
M: Jiri Pirko <jiri@nvidia.com>
1381013817
L: netdev@vger.kernel.org

drivers/hwmon/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,16 @@ config SENSORS_NZXT_KRAKEN2
15131513
This driver can also be built as a module. If so, the module
15141514
will be called nzxt-kraken2.
15151515

1516+
config SENSORS_NZXT_SMART2
1517+
tristate "NZXT RGB & Fan Controller/Smart Device v2"
1518+
depends on USB_HID
1519+
help
1520+
If you say yes here you get support for hardware monitoring for the
1521+
NZXT RGB & Fan Controller/Smart Device v2.
1522+
1523+
This driver can also be built as a module. If so, the module
1524+
will be called nzxt-smart2.
1525+
15161526
source "drivers/hwmon/occ/Kconfig"
15171527

15181528
config SENSORS_PCF8591

drivers/hwmon/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ obj-$(CONFIG_SENSORS_NPCM7XX) += npcm750-pwm-fan.o
160160
obj-$(CONFIG_SENSORS_NSA320) += nsa320-hwmon.o
161161
obj-$(CONFIG_SENSORS_NTC_THERMISTOR) += ntc_thermistor.o
162162
obj-$(CONFIG_SENSORS_NZXT_KRAKEN2) += nzxt-kraken2.o
163+
obj-$(CONFIG_SENSORS_NZXT_SMART2) += nzxt-smart2.o
163164
obj-$(CONFIG_SENSORS_PC87360) += pc87360.o
164165
obj-$(CONFIG_SENSORS_PC87427) += pc87427.o
165166
obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o

0 commit comments

Comments
 (0)