sound/soc/meson/axg-fifo.c
Source file repositories/reference/linux-study-clean/sound/soc/meson/axg-fifo.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/meson/axg-fifo.c- Extension
.c- Size
- 10304 bytes
- Lines
- 399
- 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.
- 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/bitfield.hlinux/clk.hlinux/of_irq.hlinux/of_platform.hlinux/module.hlinux/regmap.hlinux/reset.hsound/pcm_params.hsound/soc.hsound/soc-dai.haxg-fifo.h
Detected Declarations
function __dma_enablefunction axg_fifo_pcm_triggerfunction axg_fifo_pcm_pointerfunction axg_fifo_pcm_hw_paramsfunction g12a_fifo_pcm_hw_paramsfunction axg_fifo_pcm_hw_freefunction axg_fifo_ack_irqfunction axg_fifo_pcm_irq_blockfunction axg_fifo_pcm_openfunction axg_fifo_pcm_closefunction axg_fifo_pcm_newfunction axg_fifo_probeexport axg_fifo_pcm_triggerexport axg_fifo_pcm_pointerexport axg_fifo_pcm_hw_paramsexport g12a_fifo_pcm_hw_paramsexport axg_fifo_pcm_hw_freeexport axg_fifo_pcm_openexport axg_fifo_pcm_closeexport axg_fifo_pcm_newexport axg_fifo_probe
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
//
// Copyright (c) 2018 BayLibre, SAS.
// Author: Jerome Brunet <jbrunet@baylibre.com>
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/reset.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dai.h>
#include "axg-fifo.h"
/*
* This file implements the platform operations common to the playback and
* capture frontend DAI. The logic behind this two types of fifo is very
* similar but some difference exist.
* These differences are handled in the respective DAI drivers
*/
static const struct snd_pcm_hardware axg_fifo_hw = {
.info = (SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_NO_PERIOD_WAKEUP),
.formats = AXG_FIFO_FORMATS,
.rate_min = 5512,
.rate_max = 768000,
.channels_min = 1,
.channels_max = AXG_FIFO_CH_MAX,
.period_bytes_min = AXG_FIFO_BURST,
.period_bytes_max = UINT_MAX,
.periods_min = 2,
.periods_max = UINT_MAX,
/* No real justification for this */
.buffer_bytes_max = 1 * 1024 * 1024,
};
static struct snd_soc_dai *axg_fifo_dai(struct snd_pcm_substream *ss)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(ss);
return snd_soc_rtd_to_cpu(rtd, 0);
}
static struct axg_fifo *axg_fifo_data(struct snd_pcm_substream *ss)
{
struct snd_soc_dai *dai = axg_fifo_dai(ss);
return snd_soc_dai_get_drvdata(dai);
}
static struct device *axg_fifo_dev(struct snd_pcm_substream *ss)
{
struct snd_soc_dai *dai = axg_fifo_dai(ss);
return dai->dev;
}
static void __dma_enable(struct axg_fifo *fifo, bool enable)
{
regmap_update_bits(fifo->map, FIFO_CTRL0, CTRL0_DMA_EN,
enable ? CTRL0_DMA_EN : 0);
}
int axg_fifo_pcm_trigger(struct snd_soc_component *component,
struct snd_pcm_substream *ss, int cmd)
{
struct axg_fifo *fifo = axg_fifo_data(ss);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
__dma_enable(fifo, true);
break;
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_STOP:
__dma_enable(fifo, false);
break;
default:
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/of_irq.h`, `linux/of_platform.h`, `linux/module.h`, `linux/regmap.h`, `linux/reset.h`, `sound/pcm_params.h`.
- Detected declarations: `function __dma_enable`, `function axg_fifo_pcm_trigger`, `function axg_fifo_pcm_pointer`, `function axg_fifo_pcm_hw_params`, `function g12a_fifo_pcm_hw_params`, `function axg_fifo_pcm_hw_free`, `function axg_fifo_ack_irq`, `function axg_fifo_pcm_irq_block`, `function axg_fifo_pcm_open`, `function axg_fifo_pcm_close`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration 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.