sound/soc/fsl/fsl_aud2htx.c
Source file repositories/reference/linux-study-clean/sound/soc/fsl/fsl_aud2htx.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/fsl/fsl_aud2htx.c- Extension
.c- Size
- 7815 bytes
- Lines
- 310
- 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/clk-provider.hlinux/delay.hlinux/dmaengine.hlinux/mod_devicetable.hlinux/module.hlinux/pm_runtime.hlinux/regmap.hlinux/slab.hlinux/time.hlinux/pm_qos.hsound/core.hsound/dmaengine_pcm.hsound/pcm_params.hlinux/dma-mapping.hfsl_aud2htx.himx-pcm.h
Detected Declarations
function fsl_aud2htx_triggerfunction fsl_aud2htx_dai_probefunction fsl_aud2htx_readable_regfunction fsl_aud2htx_writeable_regfunction fsl_aud2htx_volatile_regfunction fsl_aud2htx_isrfunction fsl_aud2htx_probefunction fsl_aud2htx_removefunction fsl_aud2htx_runtime_suspendfunction fsl_aud2htx_runtime_resume
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
// Copyright 2020 NXP
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/pm_qos.h>
#include <sound/core.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm_params.h>
#include <linux/dma-mapping.h>
#include "fsl_aud2htx.h"
#include "imx-pcm.h"
static int fsl_aud2htx_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
struct fsl_aud2htx *aud2htx = snd_soc_dai_get_drvdata(dai);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL,
AUD2HTX_CTRL_EN, AUD2HTX_CTRL_EN);
regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT,
AUD2HTX_CTRE_DE, AUD2HTX_CTRE_DE);
break;
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT,
AUD2HTX_CTRE_DE, 0);
regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL,
AUD2HTX_CTRL_EN, 0);
break;
default:
return -EINVAL;
}
return 0;
}
static int fsl_aud2htx_dai_probe(struct snd_soc_dai *cpu_dai)
{
struct fsl_aud2htx *aud2htx = dev_get_drvdata(cpu_dai->dev);
/* DMA request when number of entries < WTMK_LOW */
regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT,
AUD2HTX_CTRE_DT_MASK, 0);
/* Disable interrupts*/
regmap_update_bits(aud2htx->regmap, AUD2HTX_IRQ_MASK,
AUD2HTX_WM_HIGH_IRQ_MASK |
AUD2HTX_WM_LOW_IRQ_MASK |
AUD2HTX_OVF_MASK,
AUD2HTX_WM_HIGH_IRQ_MASK |
AUD2HTX_WM_LOW_IRQ_MASK |
AUD2HTX_OVF_MASK);
/* Configure watermark */
regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT,
AUD2HTX_CTRE_WL_MASK,
AUD2HTX_WTMK_LOW << AUD2HTX_CTRE_WL_SHIFT);
regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT,
AUD2HTX_CTRE_WH_MASK,
AUD2HTX_WTMK_HIGH << AUD2HTX_CTRE_WH_SHIFT);
snd_soc_dai_init_dma_data(cpu_dai, &aud2htx->dma_params_tx,
&aud2htx->dma_params_rx);
return 0;
}
static const struct snd_soc_dai_ops fsl_aud2htx_dai_ops = {
.probe = fsl_aud2htx_dai_probe,
.trigger = fsl_aud2htx_trigger,
};
static struct snd_soc_dai_driver fsl_aud2htx_dai = {
.playback = {
.stream_name = "CPU-Playback",
.channels_min = 1,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/delay.h`, `linux/dmaengine.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regmap.h`.
- Detected declarations: `function fsl_aud2htx_trigger`, `function fsl_aud2htx_dai_probe`, `function fsl_aud2htx_readable_reg`, `function fsl_aud2htx_writeable_reg`, `function fsl_aud2htx_volatile_reg`, `function fsl_aud2htx_isr`, `function fsl_aud2htx_probe`, `function fsl_aud2htx_remove`, `function fsl_aud2htx_runtime_suspend`, `function fsl_aud2htx_runtime_resume`.
- 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.