drivers/clk/meson/axg-audio.c
Source file repositories/reference/linux-study-clean/drivers/clk/meson/axg-audio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/meson/axg-audio.c- Extension
.c- Size
- 56039 bytes
- Lines
- 1449
- Domain
- Driver Families
- Bucket
- drivers/clk
- Inferred role
- Driver Families: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/auxiliary_bus.hlinux/clk.hlinux/clk-provider.hlinux/init.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/reset.hlinux/slab.hmeson-clkc-utils.hclk-regmap.hclk-phase.hsclk-div.hdt-bindings/clock/axg-audio-clkc.h
Detected Declarations
struct audioclk_datafunction Copyrightfunction axg_audio_clkc_probe
Annotated Snippet
struct audioclk_data {
struct meson_clk_hw_data hw_clks;
const char *rst_drvname;
unsigned int max_register;
};
static int axg_audio_clkc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
const struct audioclk_data *data;
struct auxiliary_device *auxdev;
struct regmap *map;
void __iomem *regs;
struct clk_hw *hw;
struct clk *clk;
int ret, i;
data = of_device_get_match_data(dev);
if (!data)
return -EINVAL;
regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(regs))
return PTR_ERR(regs);
axg_audio_regmap_cfg.max_register = data->max_register;
map = devm_regmap_init_mmio(dev, regs, &axg_audio_regmap_cfg);
if (IS_ERR(map)) {
dev_err(dev, "failed to init regmap: %ld\n", PTR_ERR(map));
return PTR_ERR(map);
}
/* Get the mandatory peripheral clock */
clk = devm_clk_get_enabled(dev, "pclk");
if (IS_ERR(clk))
return PTR_ERR(clk);
ret = device_reset(dev);
if (ret) {
dev_err_probe(dev, ret, "failed to reset device\n");
return ret;
}
/* Take care to skip the registered input clocks */
for (i = AUD_CLKID_DDR_ARB; i < data->hw_clks.num; i++) {
const char *name;
hw = data->hw_clks.hws[i];
/* array might be sparse */
if (!hw)
continue;
name = hw->init->name;
ret = devm_clk_hw_register(dev, hw);
if (ret) {
dev_err(dev, "failed to register clock %s\n", name);
return ret;
}
}
ret = devm_of_clk_add_hw_provider(dev, meson_clk_hw_get, (void *)&data->hw_clks);
if (ret)
return ret;
/* Register auxiliary reset driver when applicable */
if (data->rst_drvname) {
auxdev = __devm_auxiliary_device_create(dev, dev->driver->name,
data->rst_drvname, NULL, 0);
if (!auxdev)
return -ENODEV;
}
return 0;
}
static const struct audioclk_data axg_audioclk_data = {
.hw_clks = {
.hws = axg_audio_hw_clks,
.num = ARRAY_SIZE(axg_audio_hw_clks),
},
.max_register = AUDIO_CLK_PDMIN_CTRL1,
};
static const struct audioclk_data g12a_audioclk_data = {
.hw_clks = {
.hws = g12a_audio_hw_clks,
.num = ARRAY_SIZE(g12a_audio_hw_clks),
},
.rst_drvname = "rst-g12a",
Annotation
- Immediate include surface: `linux/auxiliary_bus.h`, `linux/clk.h`, `linux/clk-provider.h`, `linux/init.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`.
- Detected declarations: `struct audioclk_data`, `function Copyright`, `function axg_audio_clkc_probe`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: source 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.