sound/soc/codecs/cs35l45.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs35l45.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/cs35l45.c- Extension
.c- Size
- 45922 bytes
- Lines
- 1517
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/gpio/consumer.hlinux/module.hlinux/pm_runtime.hlinux/property.hlinux/firmware.hlinux/regulator/consumer.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/tlv.hcs35l45.h
Detected Declarations
function cs35l45_check_cspl_mbox_stsfunction cs35l45_set_cspl_mbox_cmdfunction cs35l45_global_en_evfunction cs35l45_dsp_preload_evfunction cs35l45_dsp_audio_evfunction cs35l45_activate_ctlfunction cs35l45_amplifier_mode_getfunction cs35l45_amplifier_mode_putfunction cs35l45_set_pllfunction cs35l45_asp_set_fmtfunction cs35l45_asp_hw_paramsfunction cs35l45_asp_set_tdm_slotfunction cs35l45_asp_set_sysclkfunction cs35l45_mute_streamfunction cs35l45_component_probefunction cs35l45_component_removefunction cs35l45_setup_hibernatefunction cs35l45_enter_hibernatefunction cs35l45_exit_hibernatefunction cs35l45_runtime_suspendfunction cs35l45_runtime_resumefunction cs35l45_sys_suspendfunction cs35l45_sys_suspend_noirqfunction cs35l45_sys_resume_noirqfunction cs35l45_sys_resumefunction cs35l45_apply_property_configfunction cs35l45_dsp_virt2_mbox3_irq_handlefunction cs35l45_dsp_virt2_mbox_cbfunction cs35l45_pll_unlockfunction cs35l45_pll_lockfunction cs35l45_spk_safe_errfunction cs35l45_initializefunction cs35l45_dsp_initfunction cs35l45_probefunction cs35l45_remove
Annotated Snippet
if (ret < 0) {
dev_err(cs35l45->dev, "Failed to read MBOX STS: %d\n", ret);
continue;
}
if (!cs35l45_check_cspl_mbox_sts(cmd, sts))
dev_dbg(cs35l45->dev, "[%u] cmd %u returned invalid sts %u", i, cmd, sts);
else
return 0;
}
if (cmd != CSPL_MBOX_CMD_OUT_OF_HIBERNATE)
dev_err(cs35l45->dev, "Failed to set mailbox cmd %u (status %u)\n", cmd, sts);
return -ENOMSG;
}
static int cs35l45_global_en_ev(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 cs35l45_private *cs35l45 = snd_soc_component_get_drvdata(component);
dev_dbg(cs35l45->dev, "%s event : %x\n", __func__, event);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
regmap_write(cs35l45->regmap, CS35L45_GLOBAL_ENABLES,
CS35L45_GLOBAL_EN_MASK);
usleep_range(CS35L45_POST_GLOBAL_EN_US, CS35L45_POST_GLOBAL_EN_US + 100);
break;
case SND_SOC_DAPM_PRE_PMD:
usleep_range(CS35L45_PRE_GLOBAL_DIS_US, CS35L45_PRE_GLOBAL_DIS_US + 100);
regmap_write(cs35l45->regmap, CS35L45_GLOBAL_ENABLES, 0);
break;
default:
break;
}
return 0;
}
static int cs35l45_dsp_preload_ev(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 cs35l45_private *cs35l45 = snd_soc_component_get_drvdata(component);
int ret;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (cs35l45->dsp.cs_dsp.booted)
return 0;
return wm_adsp_early_event(w, kcontrol, event);
case SND_SOC_DAPM_POST_PMU:
if (cs35l45->dsp.cs_dsp.running)
return 0;
regmap_set_bits(cs35l45->regmap, CS35L45_PWRMGT_CTL,
CS35L45_MEM_RDY_MASK);
return wm_adsp_event(w, kcontrol, event);
case SND_SOC_DAPM_PRE_PMD:
if (cs35l45->dsp.preloaded)
return 0;
if (cs35l45->dsp.cs_dsp.running) {
ret = wm_adsp_event(w, kcontrol, event);
if (ret)
return ret;
}
return wm_adsp_early_event(w, kcontrol, event);
default:
return 0;
}
}
static int cs35l45_dsp_audio_ev(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 cs35l45_private *cs35l45 = snd_soc_component_get_drvdata(component);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
return cs35l45_set_cspl_mbox_cmd(cs35l45, cs35l45->regmap,
Annotation
- Immediate include surface: `linux/gpio/consumer.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/property.h`, `linux/firmware.h`, `linux/regulator/consumer.h`, `sound/core.h`, `sound/pcm.h`.
- Detected declarations: `function cs35l45_check_cspl_mbox_sts`, `function cs35l45_set_cspl_mbox_cmd`, `function cs35l45_global_en_ev`, `function cs35l45_dsp_preload_ev`, `function cs35l45_dsp_audio_ev`, `function cs35l45_activate_ctl`, `function cs35l45_amplifier_mode_get`, `function cs35l45_amplifier_mode_put`, `function cs35l45_set_pll`, `function cs35l45_asp_set_fmt`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.