drivers/hwmon/emc1812.c
Source file repositories/reference/linux-study-clean/drivers/hwmon/emc1812.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwmon/emc1812.c- Extension
.c- Size
- 27627 bytes
- Lines
- 966
- 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/bitfield.hlinux/bitops.hlinux/bits.hlinux/delay.hlinux/err.hlinux/hwmon.hlinux/i2c.hlinux/kernel.hlinux/math64.hlinux/property.hlinux/regmap.hlinux/string.hlinux/units.hlinux/util_macros.h
Detected Declarations
struct emc1812_featuresstruct emc1812_dataenum emc1812_limit_typefunction emc1812_is_volatile_regfunction emc1812_is_visiblefunction emc1812_get_tempfunction emc1812_get_crit_limit_tempfunction emc1812_get_limit_tempfunction emc1812_read_regfunction emc1812_readfunction emc1812_read_stringfunction emc1812_set_hystfunction emc1812_set_tempfunction emc1812_writefunction emc1812_initfunction emc1812_parse_fw_configfunction device_for_each_child_node_scopedfunction emc1812_chip_identifyfunction emc1812_probe
Annotated Snippet
struct emc1812_features {
const char *name;
u8 phys_channels;
bool has_ext2_beta_reg;
};
static const struct emc1812_features emc1833_chip_config = {
.name = "emc1833",
.phys_channels = 3,
.has_ext2_beta_reg = true,
};
static const struct emc1812_features emc1812_chip_config = {
.name = "emc1812",
.phys_channels = 2,
.has_ext2_beta_reg = false,
};
static const struct emc1812_features emc1813_chip_config = {
.name = "emc1813",
.phys_channels = 3,
.has_ext2_beta_reg = true,
};
static const struct emc1812_features emc1814_chip_config = {
.name = "emc1814",
.phys_channels = 4,
.has_ext2_beta_reg = false,
};
static const struct emc1812_features emc1815_chip_config = {
.name = "emc1815",
.phys_channels = 5,
.has_ext2_beta_reg = false,
};
enum emc1812_limit_type {temp_min, temp_max};
static const u8 emc1812_temp_map[] = {
[hwmon_temp_min] = temp_min,
[hwmon_temp_max] = temp_max,
};
static const u8 emc1812_ideality_regs[] = {
[0] = 0xff,
[1] = EMC1812_EXT1_IDEALITY_FACTOR_ADDR,
[2] = EMC1812_EXT2_IDEALITY_FACTOR_ADDR,
[3] = EMC1812_EXT3_IDEALITY_FACTOR_ADDR,
[4] = EMC1812_EXT4_IDEALITY_FACTOR_ADDR,
};
static const u8 emc1812_temp_crit_regs[] = {
[0] = EMC1812_INT_DIODE_THERM_LIMIT_ADDR,
[1] = EMC1812_EXT1_THERM_LIMIT_ADDR,
[2] = EMC1812_EXT2_THERM_LIMIT_ADDR,
[3] = EMC1812_EXT3_THERM_LIMIT_ADDR,
[4] = EMC1812_EXT4_THERM_LIMIT_ADDR,
};
static const u8 emc1812_limit_regs[][2] = {
[0] = {
[temp_min] = EMC1812_INT_DIODE_LOW_LIMIT_ADDR,
[temp_max] = EMC1812_INT_DIODE_HIGH_LIMIT_ADDR,
},
[1] = {
[temp_min] = EMC1812_EXT1_LOW_LIMIT_HIGH_BYTE_ADDR,
[temp_max] = EMC1812_EXT1_HIGH_LIMIT_HIGH_BYTE_ADDR,
},
[2] = {
[temp_min] = EMC1812_EXT2_LOW_LIMIT_HIGH_BYTE_ADDR,
[temp_max] = EMC1812_EXT2_HIGH_LIMIT_HIGH_BYTE_ADDR,
},
[3] = {
[temp_min] = EMC1812_EXT3_LOW_LIMIT_HIGH_BYTE_ADDR,
[temp_max] = EMC1812_EXT3_HIGH_LIMIT_HIGH_BYTE_ADDR,
},
[4] = {
[temp_min] = EMC1812_EXT4_LOW_LIMIT_HIGH_BYTE_ADDR,
[temp_max] = EMC1812_EXT4_HIGH_LIMIT_HIGH_BYTE_ADDR,
},
};
static const u8 emc1812_limit_regs_low[][2] = {
[0] = {
[temp_min] = 0xff,
[temp_max] = 0xff,
},
[1] = {
[temp_min] = EMC1812_EXT1_LOW_LIMIT_LOW_BYTE_ADDR,
[temp_max] = EMC1812_EXT1_HIGH_LIMIT_LOW_BYTE_ADDR,
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/bits.h`, `linux/delay.h`, `linux/err.h`, `linux/hwmon.h`, `linux/i2c.h`, `linux/kernel.h`.
- Detected declarations: `struct emc1812_features`, `struct emc1812_data`, `enum emc1812_limit_type`, `function emc1812_is_volatile_reg`, `function emc1812_is_visible`, `function emc1812_get_temp`, `function emc1812_get_crit_limit_temp`, `function emc1812_get_limit_temp`, `function emc1812_read_reg`, `function emc1812_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.