sound/soc/soc-ops.c
Source file repositories/reference/linux-study-clean/sound/soc/soc-ops.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/soc-ops.c- Extension
.c- Size
- 22494 bytes
- Lines
- 819
- 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.
- 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/cleanup.hlinux/module.hlinux/moduleparam.hlinux/init.hlinux/pm.hlinux/bitops.hlinux/ctype.hlinux/slab.hsound/core.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/initval.h
Detected Declarations
function snd_soc_info_enum_doublefunction snd_soc_get_enum_doublefunction snd_soc_put_enum_doublefunction soc_mixer_reg_to_ctlfunction soc_mixer_ctl_to_regfunction soc_mixer_valid_ctlfunction soc_mixer_maskfunction soc_mixer_sx_maskfunction soc_info_volswfunction soc_put_volswfunction soc_get_volswfunction snd_soc_info_volswfunction snd_soc_info_volsw_sxfunction snd_soc_get_volswfunction snd_soc_put_volswfunction snd_soc_get_volsw_sxfunction snd_soc_put_volsw_sxfunction snd_soc_clip_to_platform_maxfunction snd_soc_limit_volumefunction snd_soc_bytes_infofunction snd_soc_bytes_getfunction snd_soc_bytes_putfunction snd_soc_bytes_info_extfunction snd_soc_bytes_tlv_callbackfunction snd_soc_info_xr_sxfunction snd_soc_get_xr_sxfunction snd_soc_put_xr_sxfunction snd_soc_get_strobefunction lowexport snd_soc_info_enum_doubleexport snd_soc_get_enum_doubleexport snd_soc_put_enum_doubleexport snd_soc_info_volswexport snd_soc_info_volsw_sxexport snd_soc_get_volswexport snd_soc_put_volswexport snd_soc_get_volsw_sxexport snd_soc_put_volsw_sxexport snd_soc_limit_volumeexport snd_soc_bytes_infoexport snd_soc_bytes_getexport snd_soc_bytes_putexport snd_soc_bytes_info_extexport snd_soc_bytes_tlv_callbackexport snd_soc_info_xr_sxexport snd_soc_get_xr_sxexport snd_soc_put_xr_sxexport snd_soc_get_strobe
Annotated Snippet
if (mc->reg == mc->rreg) {
val1 |= soc_mixer_ctl_to_reg(mc,
ucontrol->value.integer.value[1],
mask, mc->rshift, max);
val_mask |= mask << mc->rshift;
} else {
val2 = soc_mixer_ctl_to_reg(mc,
ucontrol->value.integer.value[1],
mask, mc->shift, max);
double_r = true;
}
}
ret = snd_soc_component_update_bits(component, mc->reg, val_mask, val1);
if (ret < 0)
return ret;
if (double_r) {
int err = snd_soc_component_update_bits(component, mc->rreg,
val_mask, val2);
/* Don't drop change flag */
if (err)
return err;
}
return ret;
}
static int soc_get_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol,
struct soc_mixer_control *mc, int mask, int max, bool sx)
{
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
unsigned int reg_val;
int val;
reg_val = snd_soc_component_read(component, mc->reg);
val = soc_mixer_reg_to_ctl(mc, reg_val, mask, mc->shift, max, sx);
ucontrol->value.integer.value[0] = val;
if (snd_soc_volsw_is_stereo(mc)) {
if (mc->reg == mc->rreg) {
val = soc_mixer_reg_to_ctl(mc, reg_val, mask, mc->rshift, max, sx);
} else {
reg_val = snd_soc_component_read(component, mc->rreg);
val = soc_mixer_reg_to_ctl(mc, reg_val, mask, mc->shift, max, sx);
}
ucontrol->value.integer.value[1] = val;
}
return 0;
}
/**
* snd_soc_info_volsw - single mixer info callback with range.
* @kcontrol: mixer control
* @uinfo: control element information
*
* Callback to provide information, with a range, about a single mixer control,
* or a double mixer control that spans 2 registers.
*
* Returns 0 for success.
*/
int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
return soc_info_volsw(kcontrol, uinfo, mc, mc->max - mc->min);
}
EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
/**
* snd_soc_info_volsw_sx - Mixer info callback for SX TLV controls
* @kcontrol: mixer control
* @uinfo: control element information
*
* Callback to provide information about a single mixer control, or a double
* mixer control that spans 2 registers of the SX TLV type. SX TLV controls
* have a range that represents both positive and negative values either side
* of zero but without a sign bit. min is the minimum register value, max is
* the number of steps.
*
* Returns 0 for success.
*/
int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/pm.h`, `linux/bitops.h`, `linux/ctype.h`, `linux/slab.h`.
- Detected declarations: `function snd_soc_info_enum_double`, `function snd_soc_get_enum_double`, `function snd_soc_put_enum_double`, `function soc_mixer_reg_to_ctl`, `function soc_mixer_ctl_to_reg`, `function soc_mixer_valid_ctl`, `function soc_mixer_mask`, `function soc_mixer_sx_mask`, `function soc_info_volsw`, `function soc_put_volsw`.
- 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.