drivers/hwmon/pmbus/acbel-fsg032.c
Source file repositories/reference/linux-study-clean/drivers/hwmon/pmbus/acbel-fsg032.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwmon/pmbus/acbel-fsg032.c- Extension
.c- Size
- 3054 bytes
- Lines
- 124
- Domain
- Driver Families
- Bucket
- drivers/hwmon
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/device.hlinux/fs.hlinux/i2c.hlinux/minmax.hlinux/module.hlinux/pmbus.hlinux/hwmon-sysfs.hpmbus.h
Detected Declarations
function acbel_fsg032_debugfs_readfunction acbel_fsg032_init_debugfsfunction acbel_fsg032_probe
Annotated Snippet
static const struct file_operations acbel_debugfs_ops = {
.llseek = noop_llseek,
.read = acbel_fsg032_debugfs_read,
.write = NULL,
.open = simple_open,
};
static void acbel_fsg032_init_debugfs(struct i2c_client *client)
{
struct dentry *debugfs = pmbus_get_debugfs_dir(client);
if (!debugfs)
return;
debugfs_create_file("fw_version", 0444, debugfs, client, &acbel_debugfs_ops);
}
static const struct i2c_device_id acbel_fsg032_id[] = {
{ .name = "acbel_fsg032" },
{ }
};
static struct pmbus_driver_info acbel_fsg032_info = {
.pages = 1,
.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN |
PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT | PMBUS_HAVE_POUT |
PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 |
PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_VOUT |
PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_TEMP |
PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_FAN12,
};
static int acbel_fsg032_probe(struct i2c_client *client)
{
u8 buf[I2C_SMBUS_BLOCK_MAX + 1];
struct device *dev = &client->dev;
int rc;
rc = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
if (rc < 0) {
dev_err(dev, "Failed to read PMBUS_MFR_ID\n");
return rc;
}
if (strncmp(buf, "ACBEL", 5)) {
buf[rc] = '\0';
dev_err(dev, "Manufacturer '%s' not supported\n", buf);
return -ENODEV;
}
rc = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
if (rc < 0) {
dev_err(dev, "Failed to read PMBUS_MFR_MODEL\n");
return rc;
}
if (strncmp(buf, "FSG032", 6)) {
buf[rc] = '\0';
dev_err(dev, "Model '%s' not supported\n", buf);
return -ENODEV;
}
rc = pmbus_do_probe(client, &acbel_fsg032_info);
if (rc)
return rc;
acbel_fsg032_init_debugfs(client);
return 0;
}
static const struct of_device_id acbel_fsg032_of_match[] = {
{ .compatible = "acbel,fsg032" },
{}
};
MODULE_DEVICE_TABLE(of, acbel_fsg032_of_match);
static struct i2c_driver acbel_fsg032_driver = {
.driver = {
.name = "acbel-fsg032",
.of_match_table = acbel_fsg032_of_match,
},
.probe = acbel_fsg032_probe,
.id_table = acbel_fsg032_id,
};
module_i2c_driver(acbel_fsg032_driver);
MODULE_AUTHOR("Lakshmi Yadlapati");
MODULE_DESCRIPTION("PMBus driver for AcBel Power System power supplies");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS("PMBUS");
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/device.h`, `linux/fs.h`, `linux/i2c.h`, `linux/minmax.h`, `linux/module.h`, `linux/pmbus.h`, `linux/hwmon-sysfs.h`.
- Detected declarations: `function acbel_fsg032_debugfs_read`, `function acbel_fsg032_init_debugfs`, `function acbel_fsg032_probe`.
- Atlas domain: Driver Families / drivers/hwmon.
- Implementation status: pattern 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.