sound/soc/mediatek/mt8365/mt8365-afe-pcm.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8365/mt8365-afe-pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8365/mt8365-afe-pcm.c- Extension
.c- Size
- 68109 bytes
- Lines
- 2281
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/delay.hlinux/module.hlinux/of.hlinux/of_address.hlinux/dma-mapping.hlinux/pm_runtime.hsound/soc.hsound/pcm_params.hmt8365-afe-common.hmt8365-afe-clk.hmt8365-reg.h../common/mtk-base-afe.h../common/mtk-afe-platform-driver.h../common/mtk-afe-fe-dai.h
Detected Declarations
struct mt8365_afe_ratefunction mt8365_afe_fs_timingfunction mt8365_afe_rate_supportedfunction mt8365_afe_channel_supportedfunction mt8365_afe_clk_group_44kfunction mt8365_afe_clk_group_48kfunction mt8365_dai_set_privfunction mt8365_afe_irq_direction_enablefunction mt8365_memif_fsfunction mt8365_irq_fsfunction mt8365_afe_cm2_mux_connfunction mt8365_afe_get_cm_update_cntfunction mt8365_afe_configure_cmfunction mt8365_afe_fe_startupfunction mt8365_afe_fe_shutdownfunction mt8365_afe_fe_hw_paramsfunction mt8365_afe_fe_hw_freefunction mt8365_afe_fe_preparefunction mt8365_afe_fe_triggerfunction mt8365_afe_hw_gain1_startupfunction mt8365_afe_hw_gain1_shutdownfunction mt8365_afe_hw_gain1_preparefunction mtk_dai_hostless_startupfunction mt8365_afe_cm2_io_input_mux_getfunction mt8365_afe_cm2_io_input_mux_putfunction mt8365_afe_irq_handlerfunction mt8365_afe_runtime_suspendfunction mt8365_afe_runtime_resumefunction mt8365_afe_suspendfunction mt8365_afe_resumefunction mt8365_afe_dev_runtime_suspendfunction mt8365_afe_dev_runtime_resumefunction mt8365_afe_init_registersfunction mt8365_dai_memif_registerfunction mt8365_afe_pcm_dev_probefunction mt8365_afe_pcm_dev_remove
Annotated Snippet
struct mt8365_afe_rate {
unsigned int rate;
unsigned int reg_val;
};
static const struct mt8365_afe_rate mt8365_afe_fs_rates[] = {
{ .rate = 8000, .reg_val = MT8365_FS_8K },
{ .rate = 11025, .reg_val = MT8365_FS_11D025K },
{ .rate = 12000, .reg_val = MT8365_FS_12K },
{ .rate = 16000, .reg_val = MT8365_FS_16K },
{ .rate = 22050, .reg_val = MT8365_FS_22D05K },
{ .rate = 24000, .reg_val = MT8365_FS_24K },
{ .rate = 32000, .reg_val = MT8365_FS_32K },
{ .rate = 44100, .reg_val = MT8365_FS_44D1K },
{ .rate = 48000, .reg_val = MT8365_FS_48K },
{ .rate = 88200, .reg_val = MT8365_FS_88D2K },
{ .rate = 96000, .reg_val = MT8365_FS_96K },
{ .rate = 176400, .reg_val = MT8365_FS_176D4K },
{ .rate = 192000, .reg_val = MT8365_FS_192K },
};
int mt8365_afe_fs_timing(unsigned int rate)
{
int i;
for (i = 0; i < ARRAY_SIZE(mt8365_afe_fs_rates); i++)
if (mt8365_afe_fs_rates[i].rate == rate)
return mt8365_afe_fs_rates[i].reg_val;
return -EINVAL;
}
bool mt8365_afe_rate_supported(unsigned int rate, unsigned int id)
{
switch (id) {
case MT8365_AFE_IO_TDM_IN:
if (rate >= 8000 && rate <= 192000)
return true;
break;
case MT8365_AFE_IO_DMIC:
if (rate >= 8000 && rate <= 48000)
return true;
break;
default:
break;
}
return false;
}
bool mt8365_afe_channel_supported(unsigned int channel, unsigned int id)
{
switch (id) {
case MT8365_AFE_IO_TDM_IN:
if (channel >= 1 && channel <= 8)
return true;
break;
case MT8365_AFE_IO_DMIC:
if (channel >= 1 && channel <= 8)
return true;
break;
default:
break;
}
return false;
}
static bool mt8365_afe_clk_group_44k(int sample_rate)
{
if (sample_rate == 11025 ||
sample_rate == 22050 ||
sample_rate == 44100 ||
sample_rate == 88200 ||
sample_rate == 176400)
return true;
else
return false;
}
static bool mt8365_afe_clk_group_48k(int sample_rate)
{
return (!mt8365_afe_clk_group_44k(sample_rate));
}
int mt8365_dai_set_priv(struct mtk_base_afe *afe, int id,
int priv_size, const void *priv_data)
{
struct mt8365_afe_private *afe_priv = afe->platform_priv;
void *temp_data;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`, `linux/dma-mapping.h`, `linux/pm_runtime.h`, `sound/soc.h`, `sound/pcm_params.h`.
- Detected declarations: `struct mt8365_afe_rate`, `function mt8365_afe_fs_timing`, `function mt8365_afe_rate_supported`, `function mt8365_afe_channel_supported`, `function mt8365_afe_clk_group_44k`, `function mt8365_afe_clk_group_48k`, `function mt8365_dai_set_priv`, `function mt8365_afe_irq_direction_enable`, `function mt8365_memif_fs`, `function mt8365_irq_fs`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.