sound/soc/sdw_utils/soc_sdw_ti_amp.c
Source file repositories/reference/linux-study-clean/sound/soc/sdw_utils/soc_sdw_ti_amp.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sdw_utils/soc_sdw_ti_amp.c- Extension
.c- Size
- 6364 bytes
- Lines
- 230
- 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/errno.hlinux/input.hsound/jack.hsound/soc-acpi.hsound/soc-dai.hsound/soc.hsound/soc_sdw_utils.h
Detected Declarations
function asoc_sdw_ti_amp_initial_settingsfunction asoc_sdw_ti_spk_rtd_initfunction for_each_rtd_codec_daisfunction asoc_sdw_ti_amp_initfunction asoc_sdw_ti_add_tac5xx2_routesfunction asoc_sdw_ti_tac5xx2_spk_rtd_initfunction for_each_rtd_codec_daisfunction asoc_sdw_ti_dmic_rtd_initfunction asoc_sdw_ti_sdca_jack_rtd_init
Annotated Snippet
if (!strncmp(prefix, "tas2783-1", strlen("tas2783-1"))) {
strscpy(speaker, "Left Spk", sizeof(speaker));
} else if (!strncmp(prefix, "tas2783-2", strlen("tas2783-2"))) {
strscpy(speaker, "Right Spk", sizeof(speaker));
} else if (!strncmp(prefix, "tas2783-3", strlen("tas2783-3"))) {
strscpy(speaker, "Left Spk2", sizeof(speaker));
} else if (!strncmp(prefix, "tas2783-4", strlen("tas2783-4"))) {
strscpy(speaker, "Right Spk2", sizeof(speaker));
} else {
ret = -EINVAL;
dev_err(card->dev, "unhandled prefix %s", prefix);
break;
}
snprintf(widget_name, sizeof(widget_name), "%s SPK", prefix);
ret = asoc_sdw_ti_amp_initial_settings(card, prefix);
if (ret)
return ret;
ret = snd_soc_dapm_add_routes(dapm, &route, 1);
if (ret)
return ret;
}
return ret;
}
EXPORT_SYMBOL_NS(asoc_sdw_ti_spk_rtd_init, "SND_SOC_SDW_UTILS");
int asoc_sdw_ti_amp_init(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links,
struct asoc_sdw_codec_info *info,
bool playback)
{
if (!playback)
return 0;
info->amp_num++;
return 0;
}
EXPORT_SYMBOL_NS(asoc_sdw_ti_amp_init, "SND_SOC_SDW_UTILS");
static int asoc_sdw_ti_add_tac5xx2_routes(struct snd_soc_dapm_context *dapm,
const char *name_prefix)
{
struct snd_soc_dapm_route routes[2];
char left_widget[TAC5XX2_WIDGET_NAME_MAX];
char right_widget[TAC5XX2_WIDGET_NAME_MAX];
if (strlen(name_prefix) > (TAC5XX2_WIDGET_NAME_MAX - 7))
return -ENAMETOOLONG;
scnprintf(left_widget, sizeof(left_widget), "%s SPK_L", name_prefix);
scnprintf(right_widget, sizeof(right_widget), "%s SPK_R", name_prefix);
routes[0] = (struct snd_soc_dapm_route){"Left Spk", NULL, left_widget};
routes[1] = (struct snd_soc_dapm_route){"Right Spk", NULL, right_widget};
return snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes));
}
int asoc_sdw_ti_tac5xx2_spk_rtd_init(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_dai *dai)
{
struct snd_soc_card *card = rtd->card;
struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret, i;
struct snd_soc_dai *codec_dai;
const char *prefix;
for_each_rtd_codec_dais(rtd, i, codec_dai) {
if (!strstr(codec_dai->name, "tac5") &&
!strstr(codec_dai->name, "tas2883"))
continue;
prefix = codec_dai->component->name_prefix;
if (!prefix) {
dev_warn(card->dev,
"No name prefix found for codec DAI: %s\n",
codec_dai->name);
continue;
}
ret = asoc_sdw_ti_add_tac5xx2_routes(dapm, prefix);
if (ret) {
dev_err(card->dev, "Failed to add routes for %s: %d\n",
prefix, ret);
return ret;
}
}
Annotation
- Immediate include surface: `linux/device.h`, `linux/errno.h`, `linux/input.h`, `sound/jack.h`, `sound/soc-acpi.h`, `sound/soc-dai.h`, `sound/soc.h`, `sound/soc_sdw_utils.h`.
- Detected declarations: `function asoc_sdw_ti_amp_initial_settings`, `function asoc_sdw_ti_spk_rtd_init`, `function for_each_rtd_codec_dais`, `function asoc_sdw_ti_amp_init`, `function asoc_sdw_ti_add_tac5xx2_routes`, `function asoc_sdw_ti_tac5xx2_spk_rtd_init`, `function for_each_rtd_codec_dais`, `function asoc_sdw_ti_dmic_rtd_init`, `function asoc_sdw_ti_sdca_jack_rtd_init`.
- 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.