Commit graph

8 commits

Author SHA1 Message Date
Krzysztof Kozlowski
98ce1fc134 hwmon: nzxt: constify pointers to hwmon_channel_info
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>
2023-04-19 07:08:37 -07:00
Kang Chen
dbfeafdad3 hwmon: (nzxt-smart2) handle failure of devm_add_action in nzxt_smart2_hid_probe
1. replace the devm_add_action with devm_add_action_or_reset to ensure
the mutex lock can be destroyed when it fails.
2. use local wrapper function mutex_fini instead of mutex_destroy to
avoid undefined behaviours.
3. add a check of devm_add_action_or_reset and return early when it fails.

Link: https://lore.kernel.org/all/f5043281-9b3e-e454-16fe-ef4cde36dfdb@roeck-us.net
Signed-off-by: Kang Chen <void0red@gmail.com>
Link: https://lore.kernel.org/r/20230227091534.907101-1-void0red@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19 07:08:31 -07:00
Aleksandr Mezin
4a148e9b1e hwmon: (nzxt-smart2) add another USB ID
This seems to be a new revision of the device. RGB controls have changed,
but this driver doesn't touch them anyway.

Fan speed control reported to be working with existing userspace (hidraw)
software, so I assume it's compatible. Fan channel count is the same.

Recently added (0x1e71, 0x2019) seems to be the same device.

Discovered in liquidctl project:

https://github.com/liquidctl/liquidctl/issues/541

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
Link: https://lore.kernel.org/r/20230219105924.333007-1-mezin.alexander@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19 07:08:31 -07:00
Herman Fries
e247510e1b hwmon: (nzxt-smart2) Add device id
Adding support for new device id
1e71:2019 NZXT NZXT RGB & Fan Controller

Signed-off-by: Herman Fries <baracoder@googlemail.com>
Link: https://lore.kernel.org/r/20221214194627.135692-1-baracoder@googlemail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03 07:30:09 -08:00
Aleksandr Mezin
887b22ec07 hwmon: (nzxt-smart2) add another USB ID
No known differences from already supported devices.

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
Link: https://lore.kernel.org/r/20220918115506.61870-1-mezin.alexander@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-09-19 06:17:06 -07:00
Colin Ian King
00f5117c5f hwmon: (nzxt-smart2) make array detect_fans_report static const
Don't populate the read-only array detect_fans_report on the stack but
instead it static const. Also makes the object code a little smaller.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220109194558.45811-1-colin.i.king@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-01-09 17:10:58 -08:00
Aleksandr Mezin
f103b2e5a6 hwmon: (nzxt-smart2) Fix "unused function" warning
Fix warning when building with CONFIG_PM=n (and CONFIG_WERROR=y):

drivers/hwmon/nzxt-smart2.c:707:12: error: ‘nzxt_smart2_hid_reset_resume’
defined but not used [-Werror=unused-function]
  707 | static int nzxt_smart2_hid_reset_resume(struct hid_device *hdev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
Link: https://lore.kernel.org/r/20211228014813.832491-1-mezin.alexander@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-12-27 18:22:04 -08:00
Aleksandr Mezin
53e68c20ae 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>
2021-12-26 15:02:07 -08:00