sound/soc/codecs/da7219.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/da7219.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/da7219.c- Extension
.c- Size
- 79728 bytes
- Lines
- 2735
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- 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/acpi.hlinux/clk.hlinux/clkdev.hlinux/clk-provider.hlinux/i2c.hlinux/of.hlinux/property.hlinux/regmap.hlinux/slab.hlinux/pm.hlinux/module.hlinux/delay.hlinux/regulator/consumer.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-dapm.hsound/initval.hsound/tlv.hasm/div64.hsound/da7219.hda7219.hda7219-aad.h
Detected Declarations
function da7219_volsw_locked_getfunction da7219_volsw_locked_putfunction da7219_enum_locked_getfunction da7219_enum_locked_putfunction da7219_alc_calibfunction da7219_mixin_gain_putfunction da7219_alc_sw_putfunction da7219_tonegen_freq_getfunction da7219_tonegen_freq_putfunction da7219_mic_pga_eventfunction da7219_dai_eventfunction da7219_settling_eventfunction da7219_mixout_eventfunction da7219_gain_ramp_eventfunction da7219_set_dai_sysclkfunction da7219_set_pllfunction da7219_set_dai_pllfunction da7219_set_dai_fmtfunction da7219_set_bclks_per_wclkfunction da7219_set_dai_tdm_slotfunction da7219_set_srfunction da7219_hw_paramsfunction da7219_fw_micbias_lvlfunction da7219_fw_mic_amp_in_selfunction da7219_set_bias_levelfunction da7219_handle_suppliesfunction da7219_wclk_preparefunction da7219_wclk_unpreparefunction da7219_wclk_is_preparedfunction da7219_wclk_recalc_ratefunction da7219_wclk_determine_ratefunction da7219_wclk_set_ratefunction da7219_bclk_recalc_ratefunction da7219_bclk_get_factorfunction da7219_bclk_determine_ratefunction da7219_bclk_set_ratefunction da7219_register_dai_clksfunction da7219_free_dai_clksfunction da7219_register_dai_clksfunction da7219_free_dai_clksfunction da7219_volatile_registerfunction da7219_probefunction da7219_removefunction da7219_suspendfunction da7219_resumefunction da7219_set_jackfunction da7219_i2c_probe
Annotated Snippet
if (da7219->micbias_on_event) {
/*
* Delay only for first capture after bias enabled to
* avoid possible DC offset related noise.
*/
da7219->micbias_on_event = false;
msleep(da7219->mic_pga_delay);
}
break;
default:
break;
}
return 0;
}
static int da7219_dai_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
struct clk *bclk = da7219->dai_clks[DA7219_DAI_BCLK_IDX];
u8 pll_ctrl, pll_status;
int i = 0, ret;
bool srm_lock = false;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (da7219->master) {
/* Enable DAI clks for master mode */
if (bclk) {
ret = clk_prepare_enable(bclk);
if (ret) {
dev_err(component->dev,
"Failed to enable DAI clks\n");
return ret;
}
} else {
snd_soc_component_update_bits(component,
DA7219_DAI_CLK_MODE,
DA7219_DAI_CLK_EN_MASK,
DA7219_DAI_CLK_EN_MASK);
}
}
/* PC synchronised to DAI */
snd_soc_component_update_bits(component, DA7219_PC_COUNT,
DA7219_PC_FREERUN_MASK, 0);
/* Slave mode, if SRM not enabled no need for status checks */
pll_ctrl = snd_soc_component_read(component, DA7219_PLL_CTRL);
if ((pll_ctrl & DA7219_PLL_MODE_MASK) != DA7219_PLL_MODE_SRM)
return 0;
/* Check SRM has locked */
do {
pll_status = snd_soc_component_read(component, DA7219_PLL_SRM_STS);
if (pll_status & DA7219_PLL_SRM_STS_SRM_LOCK) {
srm_lock = true;
} else {
++i;
msleep(50);
}
} while ((i < DA7219_SRM_CHECK_RETRIES) && (!srm_lock));
if (!srm_lock)
dev_warn(component->dev, "SRM failed to lock\n");
return 0;
case SND_SOC_DAPM_POST_PMD:
/* PC free-running */
snd_soc_component_update_bits(component, DA7219_PC_COUNT,
DA7219_PC_FREERUN_MASK,
DA7219_PC_FREERUN_MASK);
/* Disable DAI clks if in master mode */
if (da7219->master) {
if (bclk)
clk_disable_unprepare(bclk);
else
snd_soc_component_update_bits(component,
DA7219_DAI_CLK_MODE,
DA7219_DAI_CLK_EN_MASK,
0);
}
return 0;
default:
return -EINVAL;
}
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/clk.h`, `linux/clkdev.h`, `linux/clk-provider.h`, `linux/i2c.h`, `linux/of.h`, `linux/property.h`, `linux/regmap.h`.
- Detected declarations: `function da7219_volsw_locked_get`, `function da7219_volsw_locked_put`, `function da7219_enum_locked_get`, `function da7219_enum_locked_put`, `function da7219_alc_calib`, `function da7219_mixin_gain_put`, `function da7219_alc_sw_put`, `function da7219_tonegen_freq_get`, `function da7219_tonegen_freq_put`, `function da7219_mic_pga_event`.
- Atlas domain: Driver Families / sound/soc.
- 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.