sound/soc/pxa/pxa2xx-ac97-lib.c
Source file repositories/reference/linux-study-clean/sound/soc/pxa/pxa2xx-ac97-lib.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/pxa/pxa2xx-ac97-lib.c- Extension
.c- Size
- 10049 bytes
- Lines
- 421
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- 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/kernel.hlinux/platform_device.hlinux/interrupt.hlinux/clk.hlinux/delay.hlinux/gpio/consumer.hlinux/module.hlinux/io.hlinux/soc/pxa/cpu.hsound/pxa2xx-lib.hlinux/platform_data/asoc-pxa.hpxa2xx-ac97-regs.hpxa2xx-lib.h
Detected Declarations
function SDONEfunction pxa2xx_ac97_writefunction pxa_ac97_warm_pxa25xfunction pxa_ac97_cold_pxa25xfunction pxa_ac97_warm_pxa27xfunction pxa_ac97_cold_pxa27xfunction pxa_ac97_warm_pxa3xxfunction pxa_ac97_cold_pxa3xxfunction pxa2xx_ac97_try_warm_resetfunction pxa2xx_ac97_try_cold_resetfunction pxa2xx_ac97_finish_resetfunction pxa2xx_ac97_irqfunction usedfunction pxa2xx_ac97_hw_suspendfunction pxa2xx_ac97_hw_resumefunction pxa2xx_ac97_hw_probefunction pxa2xx_ac97_hw_removefunction pxa2xx_ac97_read_modrfunction pxa2xx_ac97_read_misrexport pxa2xx_ac97_read_modrexport pxa2xx_ac97_read_misr
Annotated Snippet
if (cpu_is_pxa27x()) {
writel(MISR_EOC, ac97_reg_base + MISR);
writel(PISR_EOC, ac97_reg_base + PISR);
writel(MCSR_EOC, ac97_reg_base + MCSR);
}
return IRQ_HANDLED;
}
return IRQ_NONE;
}
#ifdef CONFIG_PM
int pxa2xx_ac97_hw_suspend(void)
{
writel(readl(ac97_reg_base + GCR) | (GCR_ACLINK_OFF), ac97_reg_base + GCR);
clk_disable_unprepare(ac97_clk);
return 0;
}
int pxa2xx_ac97_hw_resume(void)
{
clk_prepare_enable(ac97_clk);
return 0;
}
#endif
int pxa2xx_ac97_hw_probe(struct platform_device *dev)
{
int ret;
int irq;
ac97_reg_base = devm_platform_ioremap_resource(dev, 0);
if (IS_ERR(ac97_reg_base)) {
dev_err(&dev->dev, "Missing MMIO resource\n");
return PTR_ERR(ac97_reg_base);
}
if (cpu_is_pxa27x()) {
/* Assert reset using GPIOD_OUT_HIGH, because reset is GPIO_ACTIVE_LOW */
rst_gpio = devm_gpiod_get_optional(&dev->dev, "reset",
GPIOD_OUT_HIGH);
if (IS_ERR(rst_gpio))
return dev_err_probe(&dev->dev, PTR_ERR(rst_gpio),
"reset gpio failed\n");
/*
* This gpio is needed for a work-around to a bug in the ac97
* controller during warm reset. The direction and level is set
* here so that it is an output driven high when switching from
* AC97_nRESET alt function to generic gpio.
*/
gpiod_set_consumer_name(rst_gpio, "pxa27x ac97 reset");
pxa27x_configure_ac97reset(rst_gpio, false);
ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
if (IS_ERR(ac97conf_clk)) {
ret = PTR_ERR(ac97conf_clk);
ac97conf_clk = NULL;
goto err_conf;
}
}
ac97_clk = clk_get(&dev->dev, "AC97CLK");
if (IS_ERR(ac97_clk)) {
ret = PTR_ERR(ac97_clk);
ac97_clk = NULL;
goto err_clk;
}
ret = clk_prepare_enable(ac97_clk);
if (ret)
goto err_clk2;
irq = platform_get_irq(dev, 0);
if (irq < 0) {
ret = irq;
goto err_irq;
}
ret = request_irq(irq, pxa2xx_ac97_irq, 0, "AC97", NULL);
if (ret < 0)
goto err_irq;
return 0;
err_irq:
writel(readl(ac97_reg_base + GCR) | (GCR_ACLINK_OFF), ac97_reg_base + GCR);
err_clk2:
clk_put(ac97_clk);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/platform_device.h`, `linux/interrupt.h`, `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/io.h`.
- Detected declarations: `function SDONE`, `function pxa2xx_ac97_write`, `function pxa_ac97_warm_pxa25x`, `function pxa_ac97_cold_pxa25x`, `function pxa_ac97_warm_pxa27x`, `function pxa_ac97_cold_pxa27x`, `function pxa_ac97_warm_pxa3xx`, `function pxa_ac97_cold_pxa3xx`, `function pxa2xx_ac97_try_warm_reset`, `function pxa2xx_ac97_try_cold_reset`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- 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.