sound/soc/fsl/fsl_rpmsg.c
Source file repositories/reference/linux-study-clean/sound/soc/fsl/fsl_rpmsg.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/fsl/fsl_rpmsg.c- Extension
.c- Size
- 10026 bytes
- Lines
- 354
- 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.
- 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/module.hlinux/of.hlinux/pm_runtime.hlinux/rpmsg.hlinux/slab.hsound/core.hsound/dmaengine_pcm.hsound/pcm_params.hfsl_rpmsg.himx-pcm.h
Detected Declarations
function fsl_rpmsg_hw_paramsfunction fsl_rpmsg_hw_freefunction fsl_rpmsg_startupfunction fsl_rpmsg_probefunction fsl_rpmsg_removefunction fsl_rpmsg_runtime_resumefunction fsl_rpmsg_runtime_suspend
Annotated Snippet
clk_is_match(pp, rpmsg->pll11k)) {
pll = pp;
break;
}
p = pp;
}
/* Switch to another pll parent if needed. */
if (pll) {
npll = (do_div(rate, 8000) ? rpmsg->pll11k : rpmsg->pll8k);
if (!clk_is_match(pll, npll)) {
ret = clk_set_parent(p, npll);
if (ret < 0)
dev_warn(dai->dev, "failed to set parent %s: %d\n",
__clk_get_name(npll), ret);
}
}
if (!(rpmsg->mclk_streams & BIT(substream->stream))) {
ret = clk_prepare_enable(rpmsg->mclk);
if (ret) {
dev_err(dai->dev, "failed to enable mclk: %d\n", ret);
return ret;
}
rpmsg->mclk_streams |= BIT(substream->stream);
}
return ret;
}
static int fsl_rpmsg_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct fsl_rpmsg *rpmsg = snd_soc_dai_get_drvdata(dai);
if (rpmsg->mclk_streams & BIT(substream->stream)) {
clk_disable_unprepare(rpmsg->mclk);
rpmsg->mclk_streams &= ~BIT(substream->stream);
}
return 0;
}
static int fsl_rpmsg_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{
return snd_pcm_hw_constraint_list(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_RATE,
&fsl_rpmsg_rate_constraints);
}
static const struct snd_soc_dai_ops fsl_rpmsg_dai_ops = {
.startup = fsl_rpmsg_startup,
.hw_params = fsl_rpmsg_hw_params,
.hw_free = fsl_rpmsg_hw_free,
};
static struct snd_soc_dai_driver fsl_rpmsg_dai = {
.playback = {
.stream_name = "CPU-Playback",
.channels_min = 2,
.channels_max = 32,
.rates = SNDRV_PCM_RATE_KNOT,
.formats = FSL_RPMSG_FORMATS,
},
.capture = {
.stream_name = "CPU-Capture",
.channels_min = 2,
.channels_max = 32,
.rates = SNDRV_PCM_RATE_KNOT,
.formats = FSL_RPMSG_FORMATS,
},
.symmetric_rate = 1,
.symmetric_channels = 1,
.symmetric_sample_bits = 1,
.ops = &fsl_rpmsg_dai_ops,
};
static const struct snd_soc_component_driver fsl_component = {
.name = "fsl-rpmsg",
};
static const struct fsl_rpmsg_soc_data imx7ulp_data = {
.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |
SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
};
static const struct fsl_rpmsg_soc_data imx8mm_data = {
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/delay.h`, `linux/dmaengine.h`, `linux/module.h`, `linux/of.h`, `linux/pm_runtime.h`, `linux/rpmsg.h`.
- Detected declarations: `function fsl_rpmsg_hw_params`, `function fsl_rpmsg_hw_free`, `function fsl_rpmsg_startup`, `function fsl_rpmsg_probe`, `function fsl_rpmsg_remove`, `function fsl_rpmsg_runtime_resume`, `function fsl_rpmsg_runtime_suspend`.
- 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.