drivers/hwmon/max1619.c
Source file repositories/reference/linux-study-clean/drivers/hwmon/max1619.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwmon/max1619.c- Extension
.c- Size
- 9526 bytes
- Lines
- 400
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/hwmon.hlinux/i2c.hlinux/init.hlinux/module.hlinux/regmap.hlinux/util_macros.h
Detected Declarations
function get_alarmsfunction max1619_temp_readfunction max1619_chip_readfunction max1619_readfunction max1619_chip_writefunction max1619_temp_writefunction max1619_writefunction max1619_is_visiblefunction max1619_detectfunction max1619_init_chipfunction max1619_reg_readfunction max1619_reg_writefunction max1619_regmap_is_volatilefunction max1619_regmap_is_writeablefunction max1619_probe
Annotated Snippet
switch (attr) {
case hwmon_chip_update_interval:
return 0644;
case hwmon_chip_alarms:
return 0444;
default:
break;
}
break;
case hwmon_temp:
switch (attr) {
case hwmon_temp_input:
return 0444;
case hwmon_temp_min:
case hwmon_temp_max:
case hwmon_temp_crit:
case hwmon_temp_crit_hyst:
return 0644;
case hwmon_temp_min_alarm:
case hwmon_temp_max_alarm:
case hwmon_temp_crit_alarm:
case hwmon_temp_fault:
return 0444;
default:
break;
}
break;
default:
break;
}
return 0;
}
static const struct hwmon_channel_info * const max1619_info[] = {
HWMON_CHANNEL_INFO(chip, HWMON_C_ALARMS | HWMON_C_UPDATE_INTERVAL),
HWMON_CHANNEL_INFO(temp,
HWMON_T_INPUT,
HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX |
HWMON_T_CRIT | HWMON_T_CRIT_HYST |
HWMON_T_MIN_ALARM | HWMON_T_MAX_ALARM |
HWMON_T_CRIT_ALARM | HWMON_T_FAULT),
NULL
};
static const struct hwmon_ops max1619_hwmon_ops = {
.is_visible = max1619_is_visible,
.read = max1619_read,
.write = max1619_write,
};
static const struct hwmon_chip_info max1619_chip_info = {
.ops = &max1619_hwmon_ops,
.info = max1619_info,
};
/* Return 0 if detection is successful, -ENODEV otherwise */
static int max1619_detect(struct i2c_client *client,
struct i2c_board_info *info)
{
struct i2c_adapter *adapter = client->adapter;
int regval;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -ENODEV;
regval = i2c_smbus_read_byte_data(client, MAX1619_REG_CONFIG);
if (regval < 0 || (regval & 0x03))
return -ENODEV;
regval = i2c_smbus_read_byte_data(client, MAX1619_REG_CONVRATE);
if (regval < 0 || regval > 0x07)
return -ENODEV;
regval = i2c_smbus_read_byte_data(client, MAX1619_REG_STATUS);
if (regval < 0 || (regval & 0x61))
return -ENODEV;
regval = i2c_smbus_read_byte_data(client, MAX1619_REG_MAN_ID);
if (regval != 0x4d)
return -ENODEV;
regval = i2c_smbus_read_byte_data(client, MAX1619_REG_CHIP_ID);
if (regval != 0x04)
return -ENODEV;
strscpy(info->type, "max1619", I2C_NAME_SIZE);
return 0;
}
static int max1619_init_chip(struct regmap *regmap)
{
int ret;
Annotation
- Immediate include surface: `linux/err.h`, `linux/hwmon.h`, `linux/i2c.h`, `linux/init.h`, `linux/module.h`, `linux/regmap.h`, `linux/util_macros.h`.
- Detected declarations: `function get_alarms`, `function max1619_temp_read`, `function max1619_chip_read`, `function max1619_read`, `function max1619_chip_write`, `function max1619_temp_write`, `function max1619_write`, `function max1619_is_visible`, `function max1619_detect`, `function max1619_init_chip`.
- 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.