sound/soc/intel/boards/sof_realtek_common.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/boards/sof_realtek_common.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/boards/sof_realtek_common.c- Extension
.c- Size
- 16955 bytes
- Lines
- 690
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/kernel.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-acpi.hsound/soc-dai.hsound/soc-dapm.hsound/sof.huapi/sound/asound.h../../codecs/rt1011.h../../codecs/rt1015.h../../codecs/rt1308.h../common/soc-intel-quirks.hsof_realtek_common.h
Detected Declarations
function get_num_codecsfunction rt1011_hw_paramsfunction for_each_rtd_codec_daisfunction rt1011_initfunction sof_rt1011_dai_linkfunction sof_rt1011_codec_conffunction rt1015p_hw_paramsfunction rt1015p_initfunction sof_rt1015p_dai_linkfunction sof_rt1015p_codec_conffunction rt1015_hw_paramsfunction for_each_rtd_codec_daisfunction speaker_codec_init_lrfunction sof_rt1015_codec_conffunction sof_rt1015_dai_linkfunction rt1308_initfunction rt1308_hw_paramsfunction sof_rt1308_dai_linkfunction rt1019p_initfunction sof_rt1019p_dai_link
Annotated Snippet
if (ret < 0) {
dev_err(codec_dai->dev, "fail to set pll, ret %d\n",
ret);
return ret;
}
ret = snd_soc_dai_set_sysclk(codec_dai, RT1011_FS_SYS_PRE_S_PLL1,
256 * srate, SND_SOC_CLOCK_IN);
if (ret < 0) {
dev_err(codec_dai->dev, "fail to set sysclk, ret %d\n",
ret);
return ret;
}
if (i >= ARRAY_SIZE(rt1011_tdm_mask)) {
dev_err(codec_dai->dev, "invalid codec index %d\n",
i);
return -ENODEV;
}
ret = snd_soc_dai_set_tdm_slot(codec_dai, rt1011_tdm_mask[i].tx,
rt1011_tdm_mask[i].rx, 4,
params_width(params));
if (ret < 0) {
dev_err(codec_dai->dev, "fail to set tdm slot, ret %d\n",
ret);
return ret;
}
}
return 0;
}
static const struct snd_soc_ops rt1011_ops = {
.hw_params = rt1011_hw_params,
};
static int rt1011_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
unsigned int num_codecs = get_num_codecs(RT1011_ACPI_HID);
int ret;
switch (num_codecs) {
case 2:
if (!soc_intel_is_cml()) {
ret = snd_soc_dapm_new_controls(dapm, realtek_2spk_widgets,
ARRAY_SIZE(realtek_2spk_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add rt1011 widgets, ret %d\n",
ret);
return ret;
}
ret = snd_soc_add_card_controls(card, realtek_2spk_kcontrols,
ARRAY_SIZE(realtek_2spk_kcontrols));
if (ret) {
dev_err(rtd->dev, "fail to add rt1011 kcontrols, ret %d\n",
ret);
return ret;
}
ret = snd_soc_dapm_add_routes(dapm, speaker_map_lr,
ARRAY_SIZE(speaker_map_lr));
if (ret) {
dev_err(rtd->dev, "fail to add rt1011 routes, ret %d\n",
ret);
return ret;
}
break;
}
/*
* register speaker widgets "WL Ext Spk" and "WR Ext Spk" to
* keep backward compatible with cml devices
*/
fallthrough;
case 4:
ret = snd_soc_dapm_new_controls(dapm, realtek_4spk_widgets, num_codecs);
if (ret) {
dev_err(rtd->dev, "fail to add rt1011 widgets, ret %d\n",
ret);
return ret;
}
ret = snd_soc_add_card_controls(card, realtek_4spk_kcontrols, num_codecs);
if (ret) {
dev_err(rtd->dev, "fail to add rt1011 controls, ret %d\n",
Annotation
- Immediate include surface: `linux/device.h`, `linux/kernel.h`, `sound/pcm.h`, `sound/pcm_params.h`, `sound/soc.h`, `sound/soc-acpi.h`, `sound/soc-dai.h`, `sound/soc-dapm.h`.
- Detected declarations: `function get_num_codecs`, `function rt1011_hw_params`, `function for_each_rtd_codec_dais`, `function rt1011_init`, `function sof_rt1011_dai_link`, `function sof_rt1011_codec_conf`, `function rt1015p_hw_params`, `function rt1015p_init`, `function sof_rt1015p_dai_link`, `function sof_rt1015p_codec_conf`.
- 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.