sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c- Extension
.c- Size
- 68209 bytes
- Lines
- 2355
- 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/delay.hlinux/dma-mapping.hlinux/module.hlinux/mfd/syscon.hlinux/of.hlinux/of_address.hlinux/of_reserved_mem.hlinux/pm_runtime.hlinux/reset.hsound/soc.h../common/mtk-afe-fe-dai.h../common/mtk-afe-platform-driver.hmt8192-afe-common.hmt8192-afe-clk.hmt8192-afe-gpio.hmt8192-interconnection.h
Detected Declarations
function mt8192_memif_fsfunction mt8192_get_dai_fsfunction mt8192_irq_fsfunction mt8192_get_memif_pbuf_sizefunction ul_tinyconn_eventfunction mt8192_is_volatile_regfunction mt8192_afe_irq_handlerfunction mt8192_afe_runtime_suspendfunction mt8192_afe_runtime_resumefunction mt8192_dai_memif_registerfunction mt8192_afe_release_reserved_memfunction mt8192_afe_pcm_dev_probefunction mt8192_afe_pcm_dev_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
//
// Mediatek ALSA SoC AFE platform driver for 8192
//
// Copyright (c) 2020 MediaTek Inc.
// Author: Shane Chien <shane.chien@mediatek.com>
//
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/mfd/syscon.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_reserved_mem.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <sound/soc.h>
#include "../common/mtk-afe-fe-dai.h"
#include "../common/mtk-afe-platform-driver.h"
#include "mt8192-afe-common.h"
#include "mt8192-afe-clk.h"
#include "mt8192-afe-gpio.h"
#include "mt8192-interconnection.h"
static const struct snd_pcm_hardware mt8192_afe_hardware = {
.info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE),
.period_bytes_min = 96,
.period_bytes_max = 4 * 48 * 1024,
.periods_min = 2,
.periods_max = 256,
.buffer_bytes_max = 4 * 48 * 1024,
.fifo_size = 0,
};
static int mt8192_memif_fs(struct snd_pcm_substream *substream,
unsigned int rate)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
return mt8192_rate_transform(afe->dev, rate, id);
}
static int mt8192_get_dai_fs(struct mtk_base_afe *afe,
int dai_id, unsigned int rate)
{
return mt8192_rate_transform(afe->dev, rate, dai_id);
}
static int mt8192_irq_fs(struct snd_pcm_substream *substream, unsigned int rate)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_component *component =
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
return mt8192_general_rate_transform(afe->dev, rate);
}
static int mt8192_get_memif_pbuf_size(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
if ((runtime->period_size * 1000) / runtime->rate > 10)
return MT8192_MEMIF_PBUF_SIZE_256_BYTES;
else
return MT8192_MEMIF_PBUF_SIZE_32_BYTES;
}
#define MTK_PCM_RATES (SNDRV_PCM_RATE_8000_48000 |\
SNDRV_PCM_RATE_88200 |\
SNDRV_PCM_RATE_96000 |\
SNDRV_PCM_RATE_176400 |\
SNDRV_PCM_RATE_192000)
#define MTK_PCM_DAI_RATES (SNDRV_PCM_RATE_8000 |\
SNDRV_PCM_RATE_16000 |\
SNDRV_PCM_RATE_32000 |\
SNDRV_PCM_RATE_48000)
Annotation
- Immediate include surface: `linux/delay.h`, `linux/dma-mapping.h`, `linux/module.h`, `linux/mfd/syscon.h`, `linux/of.h`, `linux/of_address.h`, `linux/of_reserved_mem.h`, `linux/pm_runtime.h`.
- Detected declarations: `function mt8192_memif_fs`, `function mt8192_get_dai_fs`, `function mt8192_irq_fs`, `function mt8192_get_memif_pbuf_size`, `function ul_tinyconn_event`, `function mt8192_is_volatile_reg`, `function mt8192_afe_irq_handler`, `function mt8192_afe_runtime_suspend`, `function mt8192_afe_runtime_resume`, `function mt8192_dai_memif_register`.
- 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.