sound/soc/soc-component.c
Source file repositories/reference/linux-study-clean/sound/soc/soc-component.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/soc-component.c- Extension
.c- Size
- 33675 bytes
- Lines
- 1226
- 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.
- 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
linux/module.hlinux/pm_runtime.hsound/soc.hlinux/bitops.h
Detected Declarations
function _soc_component_retfunction _soc_component_ret_reg_rwfunction soc_component_field_shiftfunction snd_soc_component_set_auxfunction snd_soc_component_initfunction masterfunction snd_soc_component_set_pllfunction snd_soc_component_seq_notifierfunction snd_soc_component_stream_eventfunction snd_soc_component_set_bias_levelfunction soc_get_kcontrol_namefunction snd_soc_component_notify_controlfunction snd_soc_component_set_jackfunction snd_soc_component_get_jack_typefunction snd_soc_component_module_getfunction snd_soc_component_module_putfunction snd_soc_component_openfunction snd_soc_component_closefunction snd_soc_component_suspendfunction snd_soc_component_resumefunction snd_soc_component_is_suspendedfunction snd_soc_component_probefunction snd_soc_component_removefunction snd_soc_component_of_xlate_dai_idfunction snd_soc_component_of_xlate_dai_namefunction snd_soc_component_regmap_val_bytesfunction snd_soc_component_init_regmapfunction snd_soc_component_exit_regmapfunction snd_soc_component_compr_openfunction snd_soc_component_compr_freefunction snd_soc_component_compr_triggerfunction for_each_rtd_componentsfunction snd_soc_component_compr_set_paramsfunction for_each_rtd_componentsfunction snd_soc_component_compr_get_paramsfunction for_each_rtd_componentsfunction snd_soc_component_compr_get_capsfunction for_each_rtd_componentsfunction snd_soc_component_compr_get_codec_capsfunction for_each_rtd_componentsfunction snd_soc_component_compr_ackfunction for_each_rtd_componentsfunction snd_soc_component_compr_pointerfunction for_each_rtd_componentsfunction snd_soc_component_compr_copyfunction for_each_rtd_componentsfunction snd_soc_component_compr_set_metadatafunction for_each_rtd_components
Annotated Snippet
else if (component->driver->read) {
ret = 0;
val = component->driver->read(component, reg);
}
else
ret = -EIO;
if (ret < 0)
return soc_component_ret_reg_rw(component, ret, reg);
return val;
}
/**
* snd_soc_component_read() - Read register value
* @component: Component to read from
* @reg: Register to read
*
* Return: read value
*/
unsigned int snd_soc_component_read(struct snd_soc_component *component,
unsigned int reg)
{
unsigned int val;
mutex_lock(&component->io_mutex);
val = soc_component_read_no_lock(component, reg);
mutex_unlock(&component->io_mutex);
return val;
}
EXPORT_SYMBOL_GPL(snd_soc_component_read);
static int soc_component_write_no_lock(
struct snd_soc_component *component,
unsigned int reg, unsigned int val)
{
int ret = -EIO;
if (component->regmap)
ret = regmap_write(component->regmap, reg, val);
else if (component->driver->write)
ret = component->driver->write(component, reg, val);
return soc_component_ret_reg_rw(component, ret, reg);
}
/**
* snd_soc_component_write() - Write register value
* @component: Component to write to
* @reg: Register to write
* @val: Value to write to the register
*
* Return: 0 on success, a negative error code otherwise.
*/
int snd_soc_component_write(struct snd_soc_component *component,
unsigned int reg, unsigned int val)
{
int ret;
mutex_lock(&component->io_mutex);
ret = soc_component_write_no_lock(component, reg, val);
mutex_unlock(&component->io_mutex);
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_component_write);
static int snd_soc_component_update_bits_legacy(
struct snd_soc_component *component, unsigned int reg,
unsigned int mask, unsigned int val, bool *change)
{
unsigned int old, new;
int ret = 0;
mutex_lock(&component->io_mutex);
old = soc_component_read_no_lock(component, reg);
new = (old & ~mask) | (val & mask);
*change = old != new;
if (*change)
ret = soc_component_write_no_lock(component, reg, new);
mutex_unlock(&component->io_mutex);
return soc_component_ret_reg_rw(component, ret, reg);
}
/**
Annotation
- Immediate include surface: `linux/module.h`, `linux/pm_runtime.h`, `sound/soc.h`, `linux/bitops.h`.
- Detected declarations: `function _soc_component_ret`, `function _soc_component_ret_reg_rw`, `function soc_component_field_shift`, `function snd_soc_component_set_aux`, `function snd_soc_component_init`, `function master`, `function snd_soc_component_set_pll`, `function snd_soc_component_seq_notifier`, `function snd_soc_component_stream_event`, `function snd_soc_component_set_bias_level`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration 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.