drivers/mfd/wm831x-core.c
Source file repositories/reference/linux-study-clean/drivers/mfd/wm831x-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/wm831x-core.c- Extension
.c- Size
- 41287 bytes
- Lines
- 1762
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/init.hlinux/export.hlinux/bcd.hlinux/delay.hlinux/mfd/core.hlinux/slab.hlinux/err.hlinux/mod_devicetable.hlinux/mfd/wm831x/core.hlinux/mfd/wm831x/pdata.hlinux/mfd/wm831x/irq.hlinux/mfd/wm831x/auxadc.hlinux/mfd/wm831x/otp.hlinux/mfd/wm831x/pmu.hlinux/mfd/wm831x/regulator.h
Detected Declarations
function wm831x_reg_lockedfunction wm831x_reg_lockfunction wm831x_reg_unlockfunction wm831x_reg_readablefunction wm831x_reg_writeablefunction wm831x_reg_volatilefunction wm831x_reg_readfunction wm831x_bulk_readfunction wm831x_writefunction wm831x_reg_writefunction wm831x_set_bitsfunction wm831x_device_initfunction wm831x_device_suspendfunction wm831x_device_shutdownexport wm831x_isinkv_valuesexport wm831x_reg_lockexport wm831x_reg_unlockexport wm831x_reg_readexport wm831x_bulk_readexport wm831x_reg_writeexport wm831x_set_bitsexport wm831x_regmap_configexport wm831x_of_matchexport wm831x_device_shutdown
Annotated Snippet
if (rev > 0) {
wm831x->has_gpio_ena = 1;
wm831x->has_cs_sts = 1;
}
dev_info(wm831x->dev, "WM8310 revision %c\n", 'A' + rev);
break;
case WM8311:
parent = WM8311;
wm831x->num_gpio = 16;
wm831x->charger_irq_wake = 1;
if (rev > 0) {
wm831x->has_gpio_ena = 1;
wm831x->has_cs_sts = 1;
}
dev_info(wm831x->dev, "WM8311 revision %c\n", 'A' + rev);
break;
case WM8312:
parent = WM8312;
wm831x->num_gpio = 16;
wm831x->charger_irq_wake = 1;
if (rev > 0) {
wm831x->has_gpio_ena = 1;
wm831x->has_cs_sts = 1;
}
dev_info(wm831x->dev, "WM8312 revision %c\n", 'A' + rev);
break;
case WM8320:
parent = WM8320;
wm831x->num_gpio = 12;
dev_info(wm831x->dev, "WM8320 revision %c\n", 'A' + rev);
break;
case WM8321:
parent = WM8321;
wm831x->num_gpio = 12;
dev_info(wm831x->dev, "WM8321 revision %c\n", 'A' + rev);
break;
case WM8325:
parent = WM8325;
wm831x->num_gpio = 12;
dev_info(wm831x->dev, "WM8325 revision %c\n", 'A' + rev);
break;
case WM8326:
parent = WM8326;
wm831x->num_gpio = 12;
dev_info(wm831x->dev, "WM8326 revision %c\n", 'A' + rev);
break;
default:
dev_err(wm831x->dev, "Unknown WM831x device %04x\n", ret);
ret = -EINVAL;
goto err;
}
/* This will need revisiting in future but is OK for all
* current parts.
*/
if (parent != wm831x->type)
dev_warn(wm831x->dev, "Device was registered as a WM%x\n",
wm831x->type);
/* Bootstrap the user key */
ret = wm831x_reg_read(wm831x, WM831X_SECURITY_KEY);
if (ret < 0) {
dev_err(wm831x->dev, "Failed to read security key: %d\n", ret);
goto err;
}
if (ret != 0) {
dev_warn(wm831x->dev, "Security key had non-zero value %x\n",
ret);
wm831x_reg_write(wm831x, WM831X_SECURITY_KEY, 0);
}
wm831x->locked = 1;
if (pdata->pre_init) {
ret = pdata->pre_init(wm831x);
if (ret != 0) {
dev_err(wm831x->dev, "pre_init() failed: %d\n", ret);
goto err;
}
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/export.h`, `linux/bcd.h`, `linux/delay.h`, `linux/mfd/core.h`, `linux/slab.h`, `linux/err.h`.
- Detected declarations: `function wm831x_reg_locked`, `function wm831x_reg_lock`, `function wm831x_reg_unlock`, `function wm831x_reg_readable`, `function wm831x_reg_writeable`, `function wm831x_reg_volatile`, `function wm831x_reg_read`, `function wm831x_bulk_read`, `function wm831x_write`, `function wm831x_reg_write`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: integration 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.