drivers/hwmon/pmbus/max20730.c
Source file repositories/reference/linux-study-clean/drivers/hwmon/pmbus/max20730.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwmon/pmbus/max20730.c- Extension
.c- Size
- 21928 bytes
- Lines
- 788
- 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.
- 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/bits.hlinux/debugfs.hlinux/err.hlinux/i2c.hlinux/init.hlinux/kernel.hlinux/module.hlinux/mutex.hlinux/of.hlinux/pmbus.hlinux/util_macros.hpmbus.h
Detected Declarations
struct max20730_datastruct max20730_debugfs_dataenum chipsfunction max20730_debugfs_readfunction max20730_init_debugfsfunction max20730_init_debugfsfunction val_to_directfunction direct_to_valfunction max20730_read_word_datafunction max20730_write_word_datafunction max20730_probe
Annotated Snippet
static const struct file_operations max20730_fops = {
.llseek = noop_llseek,
.read = max20730_debugfs_read,
.write = NULL,
.open = simple_open,
};
static int max20730_init_debugfs(struct i2c_client *client,
struct max20730_data *data)
{
int ret, i;
struct dentry *debugfs;
struct dentry *max20730_dir;
struct max20730_debugfs_data *psu;
ret = i2c_smbus_read_word_data(client, MAX20730_MFR_DEVSET2);
if (ret < 0)
return ret;
data->mfr_devset2 = ret;
ret = i2c_smbus_read_word_data(client, MAX20730_MFR_VOUT_MIN);
if (ret < 0)
return ret;
data->mfr_voutmin = ret;
psu = devm_kzalloc(&client->dev, sizeof(*psu), GFP_KERNEL);
if (!psu)
return -ENOMEM;
psu->client = client;
debugfs = pmbus_get_debugfs_dir(client);
if (!debugfs)
return -ENOENT;
max20730_dir = debugfs_create_dir(client->name, debugfs);
for (i = 0; i < MAX20730_DEBUGFS_NUM_ENTRIES; ++i)
psu->debugfs_entries[i] = i;
debugfs_create_file("vout_min", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_VOUT_MIN],
&max20730_fops);
debugfs_create_file("frequency", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_FREQUENCY],
&max20730_fops);
debugfs_create_file("power_good_delay", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_PG_DELAY],
&max20730_fops);
debugfs_create_file("internal_gain", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_INTERNAL_GAIN],
&max20730_fops);
debugfs_create_file("boot_voltage", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_BOOT_VOLTAGE],
&max20730_fops);
debugfs_create_file("out_voltage_ramp_rate", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_OUT_V_RAMP_RATE],
&max20730_fops);
debugfs_create_file("oc_protection_mode", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_OC_PROTECT_MODE],
&max20730_fops);
debugfs_create_file("soft_start_timing", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_SS_TIMING],
&max20730_fops);
debugfs_create_file("imax", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_IMAX],
&max20730_fops);
debugfs_create_file("operation", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_OPERATION],
&max20730_fops);
debugfs_create_file("on_off_config", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_ON_OFF_CONFIG],
&max20730_fops);
debugfs_create_file("smbalert_mask", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_SMBALERT_MASK],
&max20730_fops);
debugfs_create_file("vout_mode", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_VOUT_MODE],
&max20730_fops);
debugfs_create_file("vout_command", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_VOUT_COMMAND],
&max20730_fops);
debugfs_create_file("vout_max", 0444, max20730_dir,
&psu->debugfs_entries[MAX20730_DEBUGFS_VOUT_MAX],
&max20730_fops);
return 0;
}
#else
static int max20730_init_debugfs(struct i2c_client *client,
struct max20730_data *data)
Annotation
- Immediate include surface: `linux/bits.h`, `linux/debugfs.h`, `linux/err.h`, `linux/i2c.h`, `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/mutex.h`.
- Detected declarations: `struct max20730_data`, `struct max20730_debugfs_data`, `enum chips`, `function max20730_debugfs_read`, `function max20730_init_debugfs`, `function max20730_init_debugfs`, `function val_to_direct`, `function direct_to_val`, `function max20730_read_word_data`, `function max20730_write_word_data`.
- Atlas domain: Driver Families / drivers/hwmon.
- Implementation status: pattern 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.