drivers/mfd/abx500-core.c
Source file repositories/reference/linux-study-clean/drivers/mfd/abx500-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/abx500-core.c- Extension
.c- Size
- 3592 bytes
- Lines
- 151
- Domain
- Driver Families
- Bucket
- drivers/mfd
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/list.hlinux/slab.hlinux/err.hlinux/init.hlinux/export.hlinux/mfd/abx500.h
Detected Declarations
struct abx500_device_entryfunction lookup_opsfunction abx500_register_opsfunction abx500_remove_opsfunction abx500_set_register_interruptiblefunction abx500_get_register_interruptiblefunction abx500_get_register_page_interruptiblefunction abx500_mask_and_set_register_interruptiblefunction abx500_get_chip_idfunction abx500_event_registers_startup_state_getfunction abx500_startup_irq_enabledexport abx500_register_opsexport abx500_remove_opsexport abx500_set_register_interruptibleexport abx500_get_register_interruptibleexport abx500_get_register_page_interruptibleexport abx500_mask_and_set_register_interruptibleexport abx500_get_chip_idexport abx500_event_registers_startup_state_getexport abx500_startup_irq_enabled
Annotated Snippet
struct abx500_device_entry {
struct list_head list;
struct abx500_ops ops;
struct device *dev;
};
static void lookup_ops(struct device *dev, struct abx500_ops **ops)
{
struct abx500_device_entry *dev_entry;
*ops = NULL;
list_for_each_entry(dev_entry, &abx500_list, list) {
if (dev_entry->dev == dev) {
*ops = &dev_entry->ops;
return;
}
}
}
int abx500_register_ops(struct device *dev, struct abx500_ops *ops)
{
struct abx500_device_entry *dev_entry;
dev_entry = devm_kzalloc(dev, sizeof(*dev_entry), GFP_KERNEL);
if (!dev_entry)
return -ENOMEM;
dev_entry->dev = dev;
memcpy(&dev_entry->ops, ops, sizeof(*ops));
list_add_tail(&dev_entry->list, &abx500_list);
return 0;
}
EXPORT_SYMBOL(abx500_register_ops);
void abx500_remove_ops(struct device *dev)
{
struct abx500_device_entry *dev_entry, *tmp;
list_for_each_entry_safe(dev_entry, tmp, &abx500_list, list)
if (dev_entry->dev == dev)
list_del(&dev_entry->list);
}
EXPORT_SYMBOL(abx500_remove_ops);
int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
u8 value)
{
struct abx500_ops *ops;
lookup_ops(dev->parent, &ops);
if (ops && ops->set_register)
return ops->set_register(dev, bank, reg, value);
else
return -ENOTSUPP;
}
EXPORT_SYMBOL(abx500_set_register_interruptible);
int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
u8 *value)
{
struct abx500_ops *ops;
lookup_ops(dev->parent, &ops);
if (ops && ops->get_register)
return ops->get_register(dev, bank, reg, value);
else
return -ENOTSUPP;
}
EXPORT_SYMBOL(abx500_get_register_interruptible);
int abx500_get_register_page_interruptible(struct device *dev, u8 bank,
u8 first_reg, u8 *regvals, u8 numregs)
{
struct abx500_ops *ops;
lookup_ops(dev->parent, &ops);
if (ops && ops->get_register_page)
return ops->get_register_page(dev, bank,
first_reg, regvals, numregs);
else
return -ENOTSUPP;
}
EXPORT_SYMBOL(abx500_get_register_page_interruptible);
int abx500_mask_and_set_register_interruptible(struct device *dev, u8 bank,
u8 reg, u8 bitmask, u8 bitvalues)
{
struct abx500_ops *ops;
Annotation
- Immediate include surface: `linux/list.h`, `linux/slab.h`, `linux/err.h`, `linux/init.h`, `linux/export.h`, `linux/mfd/abx500.h`.
- Detected declarations: `struct abx500_device_entry`, `function lookup_ops`, `function abx500_register_ops`, `function abx500_remove_ops`, `function abx500_set_register_interruptible`, `function abx500_get_register_interruptible`, `function abx500_get_register_page_interruptible`, `function abx500_mask_and_set_register_interruptible`, `function abx500_get_chip_id`, `function abx500_event_registers_startup_state_get`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: integration 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.