sound/soc/soc-dapm.c
Source file repositories/reference/linux-study-clean/sound/soc/soc-dapm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/soc-dapm.c- Extension
.c- Size
- 130279 bytes
- Lines
- 5025
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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.hlinux/init.hlinux/async.hlinux/cleanup.hlinux/delay.hlinux/pm.hlinux/bitops.hlinux/platform_device.hlinux/jiffies.hlinux/debugfs.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/pinctrl/consumer.hlinux/clk.hlinux/slab.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/initval.htrace/events/asoc.h
Detected Declarations
struct snd_soc_dapm_contextstruct dapm_kcontrol_datafunction dapm_assert_lockedfunction dapm_pop_waitfunction dapm_pop_dbgfunction dapm_dirty_widgetfunction dapm_mark_dirtyfunction dapm_widget_invalidate_input_pathsfunction list_for_each_entryfunction dapm_widget_invalidate_input_pathsfunction dapm_widget_invalidate_output_pathsfunction dapm_path_invalidatefunction snd_soc_dapm_mark_endpoints_dirtyfunction for_each_card_widgetsfunction dapm_readfunction dapm_set_mixer_path_statusfunction dapm_connect_muxfunction dapm_connect_mixerfunction dapm_update_widget_flagsfunction snd_soc_dapm_widget_for_each_source_pathfunction snd_soc_dapm_widget_for_each_sink_pathfunction dapm_for_each_directionfunction dapm_check_dynamic_pathfunction dapm_add_pathfunction dapm_for_each_directionfunction dapm_kcontrol_data_allocfunction dapm_kcontrol_freefunction dapm_kcontrol_add_widgetfunction dapm_kcontrol_add_pathfunction dapm_kcontrol_is_poweredfunction snd_soc_dapm_kcontrol_get_valuefunction dapm_kcontrol_set_valuefunction snd_soc_dapm_kcontrol_to_widgetfunction snd_soc_dapm_kcontrol_to_dapmfunction snd_soc_dapm_kcontrol_to_componentfunction dapm_resetfunction for_each_card_widgetsfunction dapm_update_bitsfunction dapm_test_bitsfunction dapm_async_completefunction dapm_wcache_lookupfunction list_for_each_entry_fromfunction snd_soc_dapm_force_bias_levelfunction snd_soc_dapm_init_bias_levelfunction biasfunction snd_soc_dapm_get_bias_levelfunction dapm_is_shared_kcontrolfunction for_each_card_widgets
Annotated Snippet
static const struct file_operations dapm_widget_power_fops = {
.open = simple_open,
.read = dapm_widget_power_read_file,
.llseek = default_llseek,
};
static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct snd_soc_dapm_context *dapm = file->private_data;
char *level;
switch (dapm->bias_level) {
case SND_SOC_BIAS_ON:
level = "On\n";
break;
case SND_SOC_BIAS_PREPARE:
level = "Prepare\n";
break;
case SND_SOC_BIAS_STANDBY:
level = "Standby\n";
break;
case SND_SOC_BIAS_OFF:
level = "Off\n";
break;
default:
WARN(1, "Unknown bias_level %d\n", dapm->bias_level);
level = "Unknown\n";
break;
}
return simple_read_from_buffer(user_buf, count, ppos, level,
strlen(level));
}
static const struct file_operations dapm_bias_fops = {
.open = simple_open,
.read = dapm_bias_read_file,
.llseek = default_llseek,
};
void snd_soc_dapm_debugfs_pop_time(struct dentry *parent)
{
debugfs_create_u32("dapm_pop_time", 0644, parent, &pop_time);
}
void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
struct dentry *parent)
{
if (IS_ERR_OR_NULL(parent))
return;
dapm->debugfs_dapm = debugfs_create_dir("dapm", parent);
debugfs_create_file("bias_level", 0444, dapm->debugfs_dapm, dapm,
&dapm_bias_fops);
}
static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w)
{
struct snd_soc_dapm_context *dapm = w->dapm;
if (!dapm->debugfs_dapm || !w->name)
return;
debugfs_create_file(w->name, 0444, dapm->debugfs_dapm, w,
&dapm_widget_power_fops);
}
static void dapm_debugfs_free_widget(struct snd_soc_dapm_widget *w)
{
struct snd_soc_dapm_context *dapm = w->dapm;
if (!dapm->debugfs_dapm || !w->name)
return;
debugfs_lookup_and_remove(w->name, dapm->debugfs_dapm);
}
static void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm)
{
debugfs_remove_recursive(dapm->debugfs_dapm);
dapm->debugfs_dapm = NULL;
}
#else
void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
struct dentry *parent)
{
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/async.h`, `linux/cleanup.h`, `linux/delay.h`, `linux/pm.h`, `linux/bitops.h`, `linux/platform_device.h`.
- Detected declarations: `struct snd_soc_dapm_context`, `struct dapm_kcontrol_data`, `function dapm_assert_locked`, `function dapm_pop_wait`, `function dapm_pop_dbg`, `function dapm_dirty_widget`, `function dapm_mark_dirty`, `function dapm_widget_invalidate_input_paths`, `function list_for_each_entry`, `function dapm_widget_invalidate_input_paths`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: pattern 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.