sound/soc/meson/meson-codec-glue.c
Source file repositories/reference/linux-study-clean/sound/soc/meson/meson-codec-glue.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/meson/meson-codec-glue.c- Extension
.c- Size
- 3866 bytes
- Lines
- 148
- 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.
- 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/module.hsound/pcm_params.hsound/soc.hsound/soc-dai.hmeson-codec-glue.h
Detected Declarations
function meson_codec_glue_get_inputfunction snd_soc_dapm_widget_for_each_source_pathfunction meson_codec_glue_input_set_datafunction meson_codec_glue_input_get_datafunction meson_codec_glue_output_get_input_datafunction meson_codec_glue_input_hw_paramsfunction meson_codec_glue_input_set_fmtfunction meson_codec_glue_output_startupfunction meson_codec_glue_input_dai_probefunction meson_codec_glue_input_dai_removeexport meson_codec_glue_input_get_dataexport meson_codec_glue_input_hw_paramsexport meson_codec_glue_input_set_fmtexport meson_codec_glue_output_startupexport meson_codec_glue_input_dai_probeexport meson_codec_glue_input_dai_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
//
// Copyright (c) 2019 BayLibre, SAS.
// Author: Jerome Brunet <jbrunet@baylibre.com>
#include <linux/module.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dai.h>
#include "meson-codec-glue.h"
static struct snd_soc_dapm_widget *
meson_codec_glue_get_input(struct snd_soc_dapm_widget *w)
{
struct snd_soc_dapm_path *p;
struct snd_soc_dapm_widget *in;
snd_soc_dapm_widget_for_each_source_path(w, p) {
if (!p->connect)
continue;
/* Check that we still are in the same component */
if (snd_soc_dapm_to_component(w->dapm) !=
snd_soc_dapm_to_component(p->source->dapm))
continue;
if (p->source->id == snd_soc_dapm_dai_in)
return p->source;
in = meson_codec_glue_get_input(p->source);
if (in)
return in;
}
return NULL;
}
static void meson_codec_glue_input_set_data(struct snd_soc_dai *dai,
struct meson_codec_glue_input *data)
{
snd_soc_dai_dma_data_set_playback(dai, data);
}
struct meson_codec_glue_input *
meson_codec_glue_input_get_data(struct snd_soc_dai *dai)
{
return snd_soc_dai_dma_data_get_playback(dai);
}
EXPORT_SYMBOL_GPL(meson_codec_glue_input_get_data);
static struct meson_codec_glue_input *
meson_codec_glue_output_get_input_data(struct snd_soc_dapm_widget *w)
{
struct snd_soc_dapm_widget *in =
meson_codec_glue_get_input(w);
struct snd_soc_dai *dai;
if (WARN_ON(!in))
return NULL;
dai = in->priv;
return meson_codec_glue_input_get_data(dai);
}
int meson_codec_glue_input_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
struct meson_codec_glue_input *data =
meson_codec_glue_input_get_data(dai);
data->params.rates = snd_pcm_rate_to_rate_bit(params_rate(params));
data->params.rate_min = params_rate(params);
data->params.rate_max = params_rate(params);
data->params.formats = 1ULL << (__force int) params_format(params);
data->params.channels_min = params_channels(params);
data->params.channels_max = params_channels(params);
data->params.sig_bits = dai->driver->playback.sig_bits;
return 0;
}
EXPORT_SYMBOL_GPL(meson_codec_glue_input_hw_params);
int meson_codec_glue_input_set_fmt(struct snd_soc_dai *dai,
unsigned int fmt)
{
struct meson_codec_glue_input *data =
meson_codec_glue_input_get_data(dai);
Annotation
- Immediate include surface: `linux/module.h`, `sound/pcm_params.h`, `sound/soc.h`, `sound/soc-dai.h`, `meson-codec-glue.h`.
- Detected declarations: `function meson_codec_glue_get_input`, `function snd_soc_dapm_widget_for_each_source_path`, `function meson_codec_glue_input_set_data`, `function meson_codec_glue_input_get_data`, `function meson_codec_glue_output_get_input_data`, `function meson_codec_glue_input_hw_params`, `function meson_codec_glue_input_set_fmt`, `function meson_codec_glue_output_startup`, `function meson_codec_glue_input_dai_probe`, `function meson_codec_glue_input_dai_remove`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration 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.