Commit 53e68c20 authored by Aleksandr Mezin's avatar Aleksandr Mezin Committed by Guenter Roeck
Browse files

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: default avatarAleksandr Mezin <mezin.alexander@gmail.com>
Link: https://lore.kernel.org/r/20211031033058.151014-1-mezin.alexander@gmail.com


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 1e7c94b2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ Hardware Monitoring Kernel Drivers
   nsa320
   ntc_thermistor
   nzxt-kraken2
   nzxt-smart2
   occ
   pc87360
   pc87427
+62 −0
Original line number Diff line number Diff line
.. SPDX-License-Identifier: GPL-2.0-or-later

Kernel driver nzxt-smart2
=========================

Supported devices:

- NZXT RGB & Fan controller
- NZXT Smart Device v2

Description
-----------

This driver implements monitoring and control of fans plugged into the device.
Besides typical speed monitoring and PWM duty cycle control, voltage and current
is reported for every fan.

The device also has two 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.

Usage Notes
-----------

The device should be autodetected, and the driver should load automatically.

If fans are plugged in/unplugged while the system is powered on, the driver
must be reloaded to detect configuration changes; otherwise, new fans can't
be controlled (`pwm*` changes will be ignored). It is necessary because the
device has a dedicated "detect fans" command, and currently, it is executed only
during initialization. Speed, voltage, current monitoring will work even without
reload. As an alternative to reloading the module, a userspace tool (like
`liquidctl`_) can be used to run "detect fans" command through hidraw interface.

The driver coexists with userspace tools that access the device through hidraw
interface with no known issues.

.. _liquidctl: https://github.com/liquidctl/liquidctl

Sysfs entries
-------------

=======================	========================================================
fan[1-3]_input		Fan speed monitoring (in rpm).
curr[1-3]_input		Current supplied to the fan (in milliamperes).
in[0-2]_input		Voltage supplied to the fan (in millivolts).
pwm[1-3]		Controls fan speed: PWM duty cycle for PWM-controlled
			fans, voltage for other fans. Voltage can be changed in
			9-12 V range, but the value of the sysfs attribute is
			always in 0-255 range (1 = 9V, 255 = 12V). Setting the
			attribute to 0 turns off the fan completely.
pwm[1-3]_enable		1 if the fan can be controlled by writing to the
			corresponding pwm* attribute, 0 otherwise. The device
			can control only the fans it detected itself, so the
			attribute is read-only.
pwm[1-3]_mode		Read-only, 1 for PWM-controlled fans, 0 for other fans
			(or if no fan connected).
update_interval		The interval at which all inputs are updated (in
			milliseconds). The default is 1000ms. Minimum is 250ms.
=======================	========================================================
+7 −0
Original line number Diff line number Diff line
@@ -13805,6 +13805,13 @@ S: Maintained
F:	Documentation/hwmon/nzxt-kraken2.rst
F:	drivers/hwmon/nzxt-kraken2.c
NZXT-SMART2 HARDWARE MONITORING DRIVER
M:	Aleksandr Mezin <mezin.alexander@gmail.com>
L:	linux-hwmon@vger.kernel.org
S:	Maintained
F:	Documentation/hwmon/nzxt-smart2.rst
F:	drivers/hwmon/nzxt-smart2.c
OBJAGG
M:	Jiri Pirko <jiri@nvidia.com>
L:	netdev@vger.kernel.org
+10 −0
Original line number Diff line number Diff line
@@ -1513,6 +1513,16 @@ config SENSORS_NZXT_KRAKEN2
	  This driver can also be built as a module. If so, the module
	  will be called nzxt-kraken2.

config SENSORS_NZXT_SMART2
	tristate "NZXT RGB & Fan Controller/Smart Device v2"
	depends on USB_HID
	help
	  If you say yes here you get support for hardware monitoring for the
	  NZXT RGB & Fan Controller/Smart Device v2.

	  This driver can also be built as a module. If so, the module
	  will be called nzxt-smart2.

source "drivers/hwmon/occ/Kconfig"

config SENSORS_PCF8591
+1 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ obj-$(CONFIG_SENSORS_NPCM7XX) += npcm750-pwm-fan.o
obj-$(CONFIG_SENSORS_NSA320)	+= nsa320-hwmon.o
obj-$(CONFIG_SENSORS_NTC_THERMISTOR)	+= ntc_thermistor.o
obj-$(CONFIG_SENSORS_NZXT_KRAKEN2) += nzxt-kraken2.o
obj-$(CONFIG_SENSORS_NZXT_SMART2) += nzxt-smart2.o
obj-$(CONFIG_SENSORS_PC87360)	+= pc87360.o
obj-$(CONFIG_SENSORS_PC87427)	+= pc87427.o
obj-$(CONFIG_SENSORS_PCF8591)	+= pcf8591.o
Loading