sound/soc/meson/axg-tdmin.c
Source file repositories/reference/linux-study-clean/sound/soc/meson/axg-tdmin.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/meson/axg-tdmin.c- Extension
.c- Size
- 7708 bytes
- Lines
- 261
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/of_platform.hlinux/regmap.hsound/soc.hsound/soc-dai.haxg-tdm-formatter.h
Detected Declarations
function axg_tdmin_get_befunction snd_soc_dapm_widget_for_each_source_pathfunction axg_tdmin_get_tdm_streamfunction axg_tdmin_enablefunction axg_tdmin_disablefunction axg_tdmin_prepare
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
//
// Copyright (c) 2018 BayLibre, SAS.
// Author: Jerome Brunet <jbrunet@baylibre.com>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/regmap.h>
#include <sound/soc.h>
#include <sound/soc-dai.h>
#include "axg-tdm-formatter.h"
#define TDMIN_CTRL 0x00
#define TDMIN_CTRL_ENABLE BIT(31)
#define TDMIN_CTRL_I2S_MODE BIT(30)
#define TDMIN_CTRL_RST_OUT BIT(29)
#define TDMIN_CTRL_RST_IN BIT(28)
#define TDMIN_CTRL_WS_INV BIT(25)
#define TDMIN_CTRL_SEL_SHIFT 20
#define TDMIN_CTRL_IN_BIT_SKEW_MASK GENMASK(18, 16)
#define TDMIN_CTRL_IN_BIT_SKEW(x) ((x) << 16)
#define TDMIN_CTRL_LSB_FIRST BIT(5)
#define TDMIN_CTRL_BITNUM_MASK GENMASK(4, 0)
#define TDMIN_CTRL_BITNUM(x) ((x) << 0)
#define TDMIN_SWAP 0x04
#define TDMIN_MASK0 0x08
#define TDMIN_MASK1 0x0c
#define TDMIN_MASK2 0x10
#define TDMIN_MASK3 0x14
#define TDMIN_STAT 0x18
#define TDMIN_MUTE_VAL 0x1c
#define TDMIN_MUTE0 0x20
#define TDMIN_MUTE1 0x24
#define TDMIN_MUTE2 0x28
#define TDMIN_MUTE3 0x2c
static const struct regmap_config axg_tdmin_regmap_cfg = {
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
.max_register = TDMIN_MUTE3,
};
static const char * const axg_tdmin_sel_texts[] = {
"IN 0", "IN 1", "IN 2", "IN 3", "IN 4", "IN 5", "IN 6", "IN 7",
"IN 8", "IN 9", "IN 10", "IN 11", "IN 12", "IN 13", "IN 14", "IN 15",
};
/* Change to special mux control to reset dapm */
static SOC_ENUM_SINGLE_DECL(axg_tdmin_sel_enum, TDMIN_CTRL,
TDMIN_CTRL_SEL_SHIFT, axg_tdmin_sel_texts);
static const struct snd_kcontrol_new axg_tdmin_in_mux =
SOC_DAPM_ENUM("Input Source", axg_tdmin_sel_enum);
static struct snd_soc_dai *
axg_tdmin_get_be(struct snd_soc_dapm_widget *w)
{
struct snd_soc_dapm_path *p;
struct snd_soc_dai *be;
snd_soc_dapm_widget_for_each_source_path(w, p) {
if (!p->connect)
continue;
if (p->source->id == snd_soc_dapm_dai_out)
return (struct snd_soc_dai *)p->source->priv;
be = axg_tdmin_get_be(p->source);
if (be)
return be;
}
return NULL;
}
static struct axg_tdm_stream *
axg_tdmin_get_tdm_stream(struct snd_soc_dapm_widget *w)
{
struct snd_soc_dai *be = axg_tdmin_get_be(w);
if (!be)
return NULL;
return snd_soc_dai_dma_data_get_capture(be);
}
static void axg_tdmin_enable(struct regmap *map)
{
Annotation
- Immediate include surface: `linux/module.h`, `linux/of_platform.h`, `linux/regmap.h`, `sound/soc.h`, `sound/soc-dai.h`, `axg-tdm-formatter.h`.
- Detected declarations: `function axg_tdmin_get_be`, `function snd_soc_dapm_widget_for_each_source_path`, `function axg_tdmin_get_tdm_stream`, `function axg_tdmin_enable`, `function axg_tdmin_disable`, `function axg_tdmin_prepare`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.