drivers/staging/greybus/audio_helper.c
Source file repositories/reference/linux-study-clean/drivers/staging/greybus/audio_helper.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/greybus/audio_helper.c- Extension
.c- Size
- 4379 bytes
- Lines
- 181
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
sound/core.hsound/soc.hsound/soc-dapm.haudio_helper.h
Detected Declarations
function gbaudio_dapm_link_dai_widgetfunction gbaudio_dapm_link_component_dai_widgetsfunction gbaudio_dapm_free_pathfunction gbaudio_dapm_free_widgetfunction gbaudio_dapm_free_controlsfunction list_for_each_entryfunction gbaudio_remove_controlsfunction gbaudio_remove_component_controls
Annotated Snippet
switch (w->id) {
case snd_soc_dapm_dai_in:
case snd_soc_dapm_dai_out:
continue;
default:
break;
}
if (!w->sname || !strstr(w->sname, dai_w->sname))
continue;
/*
* check if widget is already linked,
* if (w->linked)
* return;
*/
if (dai_w->id == snd_soc_dapm_dai_in) {
src = dai_w;
sink = w;
} else {
src = w;
sink = dai_w;
}
dev_dbg(dai->dev, "%s -> %s\n", src->name, sink->name);
/* Add the DAPM path and set widget's linked status
* snd_soc_dapm_add_path(w->dapm, src, sink, NULL, NULL);
* w->linked = 1;
*/
}
}
int gbaudio_dapm_link_component_dai_widgets(struct snd_soc_card *card,
struct snd_soc_dapm_context *dapm)
{
struct snd_soc_dapm_widget *dai_w;
/* For each DAI widget... */
list_for_each_entry(dai_w, &card->widgets, list) {
if (dai_w->dapm != dapm)
continue;
switch (dai_w->id) {
case snd_soc_dapm_dai_in:
case snd_soc_dapm_dai_out:
break;
default:
continue;
}
gbaudio_dapm_link_dai_widget(dai_w, card);
}
return 0;
}
static void gbaudio_dapm_free_path(struct snd_soc_dapm_path *path)
{
list_del(&path->list_node[SND_SOC_DAPM_DIR_IN]);
list_del(&path->list_node[SND_SOC_DAPM_DIR_OUT]);
list_del(&path->list_kcontrol);
list_del(&path->list);
kfree(path);
}
static void gbaudio_dapm_free_widget(struct snd_soc_dapm_widget *w)
{
struct snd_soc_dapm_path *p, *next_p;
enum snd_soc_dapm_direction dir;
list_del(&w->list);
/*
* remove source and sink paths associated to this widget.
* While removing the path, remove reference to it from both
* source and sink widgets so that path is removed only once.
*/
gbaudio_dapm_for_each_direction(dir) {
snd_soc_dapm_widget_for_each_path_safe(w, dir, p, next_p)
gbaudio_dapm_free_path(p);
}
kfree(w->kcontrols);
kfree_const(w->name);
kfree_const(w->sname);
kfree(w);
}
int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm,
const struct snd_soc_dapm_widget *widget,
int num)
{
int i;
Annotation
- Immediate include surface: `sound/core.h`, `sound/soc.h`, `sound/soc-dapm.h`, `audio_helper.h`.
- Detected declarations: `function gbaudio_dapm_link_dai_widget`, `function gbaudio_dapm_link_component_dai_widgets`, `function gbaudio_dapm_free_path`, `function gbaudio_dapm_free_widget`, `function gbaudio_dapm_free_controls`, `function list_for_each_entry`, `function gbaudio_remove_controls`, `function gbaudio_remove_component_controls`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.