drivers/hwmon/nct6694-hwmon.c
Source file repositories/reference/linux-study-clean/drivers/hwmon/nct6694-hwmon.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwmon/nct6694-hwmon.c- Extension
.c- Size
- 24622 bytes
- Lines
- 950
- 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.
- 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/bits.hlinux/bitfield.hlinux/hwmon.hlinux/kernel.hlinux/mfd/core.hlinux/mfd/nct6694.hlinux/module.hlinux/platform_device.hlinux/slab.h
Detected Declarations
struct nct6694_hwmon_dataenum nct6694_hwmon_temp_modefunction in_from_regfunction in_to_regfunction temp_from_regfunction temp_to_regfunction nct6694_in_readfunction nct6694_temp_readfunction nct6694_fan_readfunction nct6694_pwm_readfunction nct6694_in_writefunction nct6694_temp_writefunction nct6694_fan_writefunction nct6694_pwm_writefunction nct6694_readfunction nct6694_writefunction nct6694_is_visiblefunction nct6694_hwmon_initfunction nct6694_hwmon_probe
Annotated Snippet
struct nct6694_hwmon_data {
struct nct6694 *nct6694;
struct mutex lock;
struct nct6694_hwmon_control hwmon_en;
union nct6694_hwmon_rpt *rpt;
union nct6694_hwmon_msg *msg;
};
static inline long in_from_reg(u8 reg)
{
return reg * 16;
}
static inline u8 in_to_reg(long val)
{
return DIV_ROUND_CLOSEST(val, 16);
}
static inline long temp_from_reg(s8 reg)
{
return reg * 1000;
}
static inline s8 temp_to_reg(long val)
{
return DIV_ROUND_CLOSEST(val, 1000);
}
#define NCT6694_HWMON_IN_CONFIG (HWMON_I_INPUT | HWMON_I_ENABLE | \
HWMON_I_MAX | HWMON_I_MIN | \
HWMON_I_ALARM)
#define NCT6694_HWMON_TEMP_CONFIG (HWMON_T_INPUT | HWMON_T_ENABLE | \
HWMON_T_MAX | HWMON_T_MAX_HYST | \
HWMON_T_MAX_ALARM)
#define NCT6694_HWMON_FAN_CONFIG (HWMON_F_INPUT | HWMON_F_ENABLE | \
HWMON_F_MIN | HWMON_F_MIN_ALARM)
#define NCT6694_HWMON_PWM_CONFIG (HWMON_PWM_INPUT | HWMON_PWM_ENABLE | \
HWMON_PWM_FREQ)
static const struct hwmon_channel_info *nct6694_info[] = {
HWMON_CHANNEL_INFO(in,
NCT6694_HWMON_IN_CONFIG, /* VIN0 */
NCT6694_HWMON_IN_CONFIG, /* VIN1 */
NCT6694_HWMON_IN_CONFIG, /* VIN2 */
NCT6694_HWMON_IN_CONFIG, /* VIN3 */
NCT6694_HWMON_IN_CONFIG, /* VIN5 */
NCT6694_HWMON_IN_CONFIG, /* VIN6 */
NCT6694_HWMON_IN_CONFIG, /* VIN7 */
NCT6694_HWMON_IN_CONFIG, /* VIN14 */
NCT6694_HWMON_IN_CONFIG, /* VIN15 */
NCT6694_HWMON_IN_CONFIG, /* VIN16 */
NCT6694_HWMON_IN_CONFIG, /* VBAT */
NCT6694_HWMON_IN_CONFIG, /* VSB */
NCT6694_HWMON_IN_CONFIG, /* AVSB */
NCT6694_HWMON_IN_CONFIG, /* VCC */
NCT6694_HWMON_IN_CONFIG, /* VHIF */
NCT6694_HWMON_IN_CONFIG), /* VTT */
HWMON_CHANNEL_INFO(temp,
NCT6694_HWMON_TEMP_CONFIG, /* THR1 */
NCT6694_HWMON_TEMP_CONFIG, /* THR2 */
NCT6694_HWMON_TEMP_CONFIG, /* THR14 */
NCT6694_HWMON_TEMP_CONFIG, /* THR15 */
NCT6694_HWMON_TEMP_CONFIG, /* THR16 */
NCT6694_HWMON_TEMP_CONFIG, /* TDP0 */
NCT6694_HWMON_TEMP_CONFIG, /* TDP1 */
NCT6694_HWMON_TEMP_CONFIG, /* TDP2 */
NCT6694_HWMON_TEMP_CONFIG, /* TDP3 */
NCT6694_HWMON_TEMP_CONFIG, /* TDP4 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN0 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN1 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN2 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN3 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN4 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN5 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN6 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN7 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN8 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN9 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN10 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN11 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN12 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN13 */
NCT6694_HWMON_TEMP_CONFIG, /* DTIN14 */
NCT6694_HWMON_TEMP_CONFIG), /* DTIN15 */
HWMON_CHANNEL_INFO(fan,
NCT6694_HWMON_FAN_CONFIG, /* FIN0 */
NCT6694_HWMON_FAN_CONFIG, /* FIN1 */
NCT6694_HWMON_FAN_CONFIG, /* FIN2 */
NCT6694_HWMON_FAN_CONFIG, /* FIN3 */
Annotation
- Immediate include surface: `linux/bits.h`, `linux/bitfield.h`, `linux/hwmon.h`, `linux/kernel.h`, `linux/mfd/core.h`, `linux/mfd/nct6694.h`, `linux/module.h`, `linux/platform_device.h`.
- Detected declarations: `struct nct6694_hwmon_data`, `enum nct6694_hwmon_temp_mode`, `function in_from_reg`, `function in_to_reg`, `function temp_from_reg`, `function temp_to_reg`, `function nct6694_in_read`, `function nct6694_temp_read`, `function nct6694_fan_read`, `function nct6694_pwm_read`.
- Atlas domain: Driver Families / drivers/hwmon.
- Implementation status: source implementation candidate.
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.