sound/soc/mediatek/common/mtk-dai-adda-common.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/common/mtk-dai-adda-common.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/common/mtk-dai-adda-common.c- Extension
.c- Size
- 1726 bytes
- Lines
- 71
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/dev_printk.hmtk-base-afe.hmtk-dai-adda-common.h
Detected Declarations
function Copyrightfunction mtk_adda_ul_rate_transformexport mtk_adda_dl_rate_transformexport mtk_adda_ul_rate_transform
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* MediaTek ALSA SoC Audio DAI ADDA Common
*
* Copyright (c) 2021 MediaTek Inc.
* Copyright (c) 2024 Collabora Ltd.
* AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#include <linux/delay.h>
#include <linux/dev_printk.h>
#include "mtk-base-afe.h"
#include "mtk-dai-adda-common.h"
unsigned int mtk_adda_dl_rate_transform(struct mtk_base_afe *afe, u32 rate)
{
switch (rate) {
case 8000:
return MTK_AFE_ADDA_DL_RATE_8K;
case 11025:
return MTK_AFE_ADDA_DL_RATE_11K;
case 12000:
return MTK_AFE_ADDA_DL_RATE_12K;
case 16000:
return MTK_AFE_ADDA_DL_RATE_16K;
case 22050:
return MTK_AFE_ADDA_DL_RATE_22K;
case 24000:
return MTK_AFE_ADDA_DL_RATE_24K;
case 32000:
return MTK_AFE_ADDA_DL_RATE_32K;
case 44100:
return MTK_AFE_ADDA_DL_RATE_44K;
case 48000:
return MTK_AFE_ADDA_DL_RATE_48K;
case 96000:
return MTK_AFE_ADDA_DL_RATE_96K;
case 192000:
return MTK_AFE_ADDA_DL_RATE_192K;
default:
dev_info(afe->dev, "%s(), rate %d invalid, use 48kHz!!!\n",
__func__, rate);
return MTK_AFE_ADDA_DL_RATE_48K;
}
}
EXPORT_SYMBOL_GPL(mtk_adda_dl_rate_transform);
unsigned int mtk_adda_ul_rate_transform(struct mtk_base_afe *afe, u32 rate)
{
switch (rate) {
case 8000:
return MTK_AFE_ADDA_UL_RATE_8K;
case 16000:
return MTK_AFE_ADDA_UL_RATE_16K;
case 32000:
return MTK_AFE_ADDA_UL_RATE_32K;
case 48000:
return MTK_AFE_ADDA_UL_RATE_48K;
case 96000:
return MTK_AFE_ADDA_UL_RATE_96K;
case 192000:
return MTK_AFE_ADDA_UL_RATE_192K;
default:
dev_info(afe->dev, "%s(), rate %d invalid, use 48kHz!!!\n",
__func__, rate);
return MTK_AFE_ADDA_UL_RATE_48K;
}
}
EXPORT_SYMBOL_GPL(mtk_adda_ul_rate_transform);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/dev_printk.h`, `mtk-base-afe.h`, `mtk-dai-adda-common.h`.
- Detected declarations: `function Copyright`, `function mtk_adda_ul_rate_transform`, `export mtk_adda_dl_rate_transform`, `export mtk_adda_ul_rate_transform`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration 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.