sound/soc/mediatek/mt7986/mt7986-afe-pcm.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt7986/mt7986-afe-pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt7986/mt7986-afe-pcm.c- Extension
.c- Size
- 16289 bytes
- Lines
- 610
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/delay.hlinux/module.hlinux/of.hlinux/of_address.hlinux/pm_runtime.hmt7986-afe-common.hmt7986-reg.h../common/mtk-afe-platform-driver.h../common/mtk-afe-fe-dai.h
Detected Declarations
function mt7986_afe_rate_transformfunction mt7986_memif_fsfunction mt7986_irq_fsfunction mt7986_is_volatile_regfunction mt7986_init_clockfunction mt7986_afe_irq_handlerfunction mt7986_afe_runtime_suspendfunction mt7986_afe_runtime_resumefunction mt7986_dai_memif_registerfunction mt7986_afe_pcm_dev_probefunction mt7986_afe_pcm_dev_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* MediaTek ALSA SoC AFE platform driver for MT7986
*
* Copyright (c) 2023 MediaTek Inc.
* Authors: Vic Wu <vic.wu@mediatek.com>
* Maso Huang <maso.huang@mediatek.com>
*/
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/pm_runtime.h>
#include "mt7986-afe-common.h"
#include "mt7986-reg.h"
#include "../common/mtk-afe-platform-driver.h"
#include "../common/mtk-afe-fe-dai.h"
enum {
MTK_AFE_RATE_8K = 0,
MTK_AFE_RATE_11K = 1,
MTK_AFE_RATE_12K = 2,
MTK_AFE_RATE_16K = 4,
MTK_AFE_RATE_22K = 5,
MTK_AFE_RATE_24K = 6,
MTK_AFE_RATE_32K = 8,
MTK_AFE_RATE_44K = 9,
MTK_AFE_RATE_48K = 10,
MTK_AFE_RATE_88K = 13,
MTK_AFE_RATE_96K = 14,
MTK_AFE_RATE_176K = 17,
MTK_AFE_RATE_192K = 18,
};
enum {
CLK_INFRA_AUD_BUS_CK = 0,
CLK_INFRA_AUD_26M_CK,
CLK_INFRA_AUD_L_CK,
CLK_INFRA_AUD_AUD_CK,
CLK_INFRA_AUD_EG2_CK,
CLK_NUM
};
static const char *aud_clks[CLK_NUM] = {
[CLK_INFRA_AUD_BUS_CK] = "aud_bus_ck",
[CLK_INFRA_AUD_26M_CK] = "aud_26m_ck",
[CLK_INFRA_AUD_L_CK] = "aud_l_ck",
[CLK_INFRA_AUD_AUD_CK] = "aud_aud_ck",
[CLK_INFRA_AUD_EG2_CK] = "aud_eg2_ck",
};
unsigned int mt7986_afe_rate_transform(struct device *dev, unsigned int rate)
{
switch (rate) {
case 8000:
return MTK_AFE_RATE_8K;
case 11025:
return MTK_AFE_RATE_11K;
case 12000:
return MTK_AFE_RATE_12K;
case 16000:
return MTK_AFE_RATE_16K;
case 22050:
return MTK_AFE_RATE_22K;
case 24000:
return MTK_AFE_RATE_24K;
case 32000:
return MTK_AFE_RATE_32K;
case 44100:
return MTK_AFE_RATE_44K;
case 48000:
return MTK_AFE_RATE_48K;
case 88200:
return MTK_AFE_RATE_88K;
case 96000:
return MTK_AFE_RATE_96K;
case 176400:
return MTK_AFE_RATE_176K;
case 192000:
return MTK_AFE_RATE_192K;
default:
dev_warn(dev, "%s(), rate %u invalid, using %d!!!\n",
__func__, rate, MTK_AFE_RATE_48K);
return MTK_AFE_RATE_48K;
}
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`, `linux/pm_runtime.h`, `mt7986-afe-common.h`, `mt7986-reg.h`.
- Detected declarations: `function mt7986_afe_rate_transform`, `function mt7986_memif_fs`, `function mt7986_irq_fs`, `function mt7986_is_volatile_reg`, `function mt7986_init_clock`, `function mt7986_afe_irq_handler`, `function mt7986_afe_runtime_suspend`, `function mt7986_afe_runtime_resume`, `function mt7986_dai_memif_register`, `function mt7986_afe_pcm_dev_probe`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.