drivers/mfd/arizona-core.c
Source file repositories/reference/linux-study-clean/drivers/mfd/arizona-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/arizona-core.c- Extension
.c- Size
- 34315 bytes
- Lines
- 1434
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/delay.hlinux/err.hlinux/gpio/consumer.hlinux/interrupt.hlinux/mfd/core.hlinux/module.hlinux/of.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/regulator/machine.hlinux/slab.hlinux/ktime.hlinux/platform_device.hlinux/mfd/arizona/core.hlinux/mfd/arizona/registers.harizona.h
Detected Declarations
struct arizona_sysclk_statefunction arizona_clk32k_enablefunction arizona_clk32k_disablefunction arizona_clkgen_errfunction arizona_underclockedfunction arizona_overclockedfunction arizona_poll_reg_delayfunction arizona_poll_regfunction arizona_wait_for_bootfunction arizona_enable_resetfunction arizona_disable_resetfunction arizona_enable_freerun_sysclkfunction arizona_disable_freerun_sysclkfunction wm5102_apply_hardware_patchfunction wm5110_apply_sleep_patchfunction wm5102_clear_write_sequencerfunction arizona_isolate_dcvddfunction arizona_connect_dcvddfunction arizona_is_jack_det_activefunction arizona_runtime_resumefunction arizona_runtime_suspendfunction arizona_suspendfunction arizona_suspend_noirqfunction arizona_resume_noirqfunction arizona_resumefunction arizona_of_get_core_pdatafunction arizona_of_get_core_pdatafunction arizona_dev_initfunction arizona_dev_exitexport arizona_clk32k_enableexport arizona_clk32k_disableexport arizona_dev_initexport arizona_dev_exit
Annotated Snippet
struct arizona_sysclk_state {
unsigned int fll;
unsigned int sysclk;
};
static int arizona_enable_freerun_sysclk(struct arizona *arizona,
struct arizona_sysclk_state *state)
{
int ret, err;
/* Cache existing FLL and SYSCLK settings */
ret = regmap_read(arizona->regmap, ARIZONA_FLL1_CONTROL_1, &state->fll);
if (ret) {
dev_err(arizona->dev, "Failed to cache FLL settings: %d\n",
ret);
return ret;
}
ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1,
&state->sysclk);
if (ret) {
dev_err(arizona->dev, "Failed to cache SYSCLK settings: %d\n",
ret);
return ret;
}
/* Start up SYSCLK using the FLL in free running mode */
ret = regmap_write(arizona->regmap, ARIZONA_FLL1_CONTROL_1,
ARIZONA_FLL1_ENA | ARIZONA_FLL1_FREERUN);
if (ret) {
dev_err(arizona->dev,
"Failed to start FLL in freerunning mode: %d\n",
ret);
return ret;
}
ret = arizona_poll_reg(arizona, 180, ARIZONA_INTERRUPT_RAW_STATUS_5,
ARIZONA_FLL1_CLOCK_OK_STS,
ARIZONA_FLL1_CLOCK_OK_STS);
if (ret)
goto err_fll;
ret = regmap_write(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, 0x0144);
if (ret) {
dev_err(arizona->dev, "Failed to start SYSCLK: %d\n", ret);
goto err_fll;
}
return 0;
err_fll:
err = regmap_write(arizona->regmap, ARIZONA_FLL1_CONTROL_1, state->fll);
if (err)
dev_err(arizona->dev,
"Failed to re-apply old FLL settings: %d\n", err);
return ret;
}
static int arizona_disable_freerun_sysclk(struct arizona *arizona,
struct arizona_sysclk_state *state)
{
int ret;
ret = regmap_write(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1,
state->sysclk);
if (ret) {
dev_err(arizona->dev,
"Failed to re-apply old SYSCLK settings: %d\n", ret);
return ret;
}
ret = regmap_write(arizona->regmap, ARIZONA_FLL1_CONTROL_1, state->fll);
if (ret) {
dev_err(arizona->dev,
"Failed to re-apply old FLL settings: %d\n", ret);
return ret;
}
return 0;
}
static int wm5102_apply_hardware_patch(struct arizona *arizona)
{
struct arizona_sysclk_state state;
int err, ret;
ret = arizona_enable_freerun_sysclk(arizona, &state);
if (ret)
return ret;
/* Start the write sequencer and wait for it to finish */
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/err.h`, `linux/gpio/consumer.h`, `linux/interrupt.h`, `linux/mfd/core.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct arizona_sysclk_state`, `function arizona_clk32k_enable`, `function arizona_clk32k_disable`, `function arizona_clkgen_err`, `function arizona_underclocked`, `function arizona_overclocked`, `function arizona_poll_reg_delay`, `function arizona_poll_reg`, `function arizona_wait_for_boot`, `function arizona_enable_reset`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.