drivers/hwmon/nzxt-kraken3.c
Source file repositories/reference/linux-study-clean/drivers/hwmon/nzxt-kraken3.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwmon/nzxt-kraken3.c- Extension
.c- Size
- 33868 bytes
- Lines
- 1029
- Domain
- Driver Families
- Bucket
- drivers/hwmon
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/hid.hlinux/hwmon.hlinux/hwmon-sysfs.hlinux/jiffies.hlinux/module.hlinux/mutex.hlinux/spinlock.hlinux/wait.hlinux/unaligned.h
Detected Declarations
struct kraken3_channel_infostruct kraken3_dataenum kindsenum pwm_enablefunction kraken3_is_visiblefunction reportfunction kraken3_percent_to_pwmfunction kraken3_pwm_to_percentfunction kraken3_read_x53function kraken3_read_z53function kraken3_readfunction kraken3_read_stringfunction kraken3_write_curvefunction kraken3_write_fixed_dutyfunction kraken3_writefunction kraken3_fan_curve_pwm_storefunction kraken3_curve_props_are_visiblefunction kraken3_raw_eventfunction kraken3_init_devicefunction kraken3_get_fw_verfunction kraken3_reset_resumefunction firmware_version_showfunction kraken3_debugfs_initfunction kraken3_probefunction kraken3_removefunction kraken3_initfunction kraken3_exit
Annotated Snippet
struct kraken3_channel_info {
enum pwm_enable mode;
/* Both values are PWM */
u16 reported_duty;
u16 fixed_duty; /* Manually set fixed duty */
u8 pwm_points[CUSTOM_CURVE_POINTS];
};
struct kraken3_data {
struct hid_device *hdev;
struct device *hwmon_dev;
struct dentry *debugfs;
struct mutex buffer_lock; /* For locking access to buffer */
struct mutex z53_status_request_lock;
struct completion fw_version_processed;
/*
* For X53 devices, tracks whether an initial (one) sensor report was received to
* make fancontrol not bail outright. For Z53 devices, whether a status report
* was processed after requesting one.
*/
struct completion status_report_processed;
/* For locking the above completion */
spinlock_t status_completion_lock;
u8 *buffer;
struct kraken3_channel_info channel_info[2]; /* Pump and fan */
bool is_device_faulty;
/* Sensor values */
s32 temp_input[1];
u16 fan_input[2];
enum kinds kind;
u8 firmware_version[3];
unsigned long updated; /* jiffies */
};
static umode_t kraken3_is_visible(const void *data, enum hwmon_sensor_types type, u32 attr,
int channel)
{
const struct kraken3_data *priv = data;
switch (type) {
case hwmon_temp:
if (channel < 1)
return 0444;
break;
case hwmon_fan:
switch (priv->kind) {
case X53:
/* Just the pump */
if (channel < 1)
return 0444;
break;
case Z53:
case KRAKEN2023:
/* Pump and fan */
if (channel < 2)
return 0444;
break;
default:
break;
}
break;
case hwmon_pwm:
switch (attr) {
case hwmon_pwm_enable:
case hwmon_pwm_input:
switch (priv->kind) {
case X53:
/* Just the pump */
if (channel < 1)
return 0644;
break;
case Z53:
case KRAKEN2023:
/* Pump and fan */
if (channel < 2)
return 0644;
break;
default:
break;
}
break;
default:
break;
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/hid.h`, `linux/hwmon.h`, `linux/hwmon-sysfs.h`, `linux/jiffies.h`, `linux/module.h`, `linux/mutex.h`, `linux/spinlock.h`.
- Detected declarations: `struct kraken3_channel_info`, `struct kraken3_data`, `enum kinds`, `enum pwm_enable`, `function kraken3_is_visible`, `function report`, `function kraken3_percent_to_pwm`, `function kraken3_pwm_to_percent`, `function kraken3_read_x53`, `function kraken3_read_z53`.
- Atlas domain: Driver Families / drivers/hwmon.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.