sound/soc/amd/acp7x/acp7x-common.c
Source file repositories/reference/linux-study-clean/sound/soc/amd/acp7x/acp7x-common.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/amd/acp7x/acp7x-common.c- Extension
.c- Size
- 2753 bytes
- Lines
- 126
- Domain
- Driver Families
- Bucket
- sound/soc
- 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/device.hlinux/io.hlinux/iopoll.hlinux/types.hacp7x.h
Detected Declarations
function acp7x_power_onfunction acp7x_resetfunction acp7x_initfunction acp7x_deinitfunction snd_acp7x_suspendfunction snd_acp7x_runtime_resumefunction snd_acp7x_resumefunction acp7x_hw_init_ops
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* AMD ACP PCI driver callback routines for ACP7.x
* platforms.
*
* Copyright 2026 Advanced Micro Devices, Inc.
*/
#include <linux/device.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/types.h>
#include "acp7x.h"
static int acp7x_power_on(void __iomem *acp_base)
{
u32 val = 0;
val = readl(acp_base + ACP_PGFSM_STATUS);
if (!(val & ACP7X_PGFSM_STATUS_MASK))
return 0;
writel(ACP7X_PGFSM_CNTL_POWER_ON_MASK, acp_base + ACP_PGFSM_CONTROL);
val = readl(acp_base + ACP_PGFSM_CONTROL);
return readl_poll_timeout(acp_base + ACP_PGFSM_STATUS, val,
((val & ACP7X_PGFSM_STATUS_MASK) == 0), DELAY_US, ACP7X_TIMEOUT);
}
static int acp7x_reset(void __iomem *acp_base)
{
u32 val;
int ret;
writel(1, acp_base + ACP_SOFT_RESET);
ret = readl_poll_timeout(acp_base + ACP_SOFT_RESET, val,
val & ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK,
DELAY_US, ACP7X_TIMEOUT);
if (ret)
return ret;
writel(0, acp_base + ACP_SOFT_RESET);
return readl_poll_timeout(acp_base + ACP_SOFT_RESET, val, !val, DELAY_US, ACP7X_TIMEOUT);
}
static int acp7x_init(void __iomem *acp_base, struct device *dev)
{
int ret;
ret = acp7x_power_on(acp_base);
if (ret) {
dev_err(dev, "ACP power on failed\n");
return ret;
}
writel(0x01, acp_base + ACP_CONTROL);
ret = acp7x_reset(acp_base);
if (ret) {
dev_err(dev, "ACP reset failed\n");
return ret;
}
writel(0, acp_base + ACP_ZSC_DSP_CTRL);
return 0;
}
static int acp7x_deinit(void __iomem *acp_base, struct device *dev)
{
int ret;
ret = acp7x_reset(acp_base);
if (ret) {
dev_err(dev, "ACP reset failed\n");
return ret;
}
writel(0x01, acp_base + ACP_ZSC_DSP_CTRL);
return 0;
}
static int __maybe_unused snd_acp7x_suspend(struct device *dev)
{
struct acp7x_dev_data *adata;
int ret;
adata = dev_get_drvdata(dev);
ret = acp_hw_deinit(adata, dev);
if (ret)
dev_err(dev, "ACP de-init failed\n");
return ret;
}
static int __maybe_unused snd_acp7x_runtime_resume(struct device *dev)
Annotation
- Immediate include surface: `linux/device.h`, `linux/io.h`, `linux/iopoll.h`, `linux/types.h`, `acp7x.h`.
- Detected declarations: `function acp7x_power_on`, `function acp7x_reset`, `function acp7x_init`, `function acp7x_deinit`, `function snd_acp7x_suspend`, `function snd_acp7x_runtime_resume`, `function snd_acp7x_resume`, `function acp7x_hw_init_ops`.
- Atlas domain: Driver Families / sound/soc.
- 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.