sound/soc/codecs/cs47l15.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs47l15.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/cs47l15.c- Extension
.c- Size
- 52070 bytes
- Lines
- 1506
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/moduleparam.hlinux/device.hlinux/delay.hlinux/init.hlinux/pm.hlinux/pm_runtime.hlinux/regmap.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/tlv.hlinux/irqchip/irq-madera.hlinux/mfd/madera/core.hlinux/mfd/madera/registers.hmadera.hwm_adsp.h
Detected Declarations
struct cs47l15function cs47l15_adsp_power_evfunction cs47l15_in1_adc_getfunction cs47l15_in1_adc_putfunction cs47l15_set_fllfunction cs47l15_openfunction cs47l15_adsp2_irqfunction cs47l15_component_probefunction cs47l15_component_removefunction cs47l15_probefunction cs47l15_remove
Annotated Snippet
struct cs47l15 {
struct madera_priv core;
struct madera_fll fll[2];
bool in1_lp_mode;
};
static const struct cs_dsp_region cs47l15_dsp1_regions[] = {
{ .type = WMFW_ADSP2_PM, .base = 0x080000 },
{ .type = WMFW_ADSP2_ZM, .base = 0x0e0000 },
{ .type = WMFW_ADSP2_XM, .base = 0x0a0000 },
{ .type = WMFW_ADSP2_YM, .base = 0x0c0000 },
};
static const char * const cs47l15_outdemux_texts[] = {
"HPOUT",
"EPOUT",
};
static SOC_ENUM_SINGLE_DECL(cs47l15_outdemux_enum, SND_SOC_NOPM, 0,
cs47l15_outdemux_texts);
static const struct snd_kcontrol_new cs47l15_outdemux =
SOC_DAPM_ENUM_EXT("HPOUT1 Demux", cs47l15_outdemux_enum,
madera_out1_demux_get, madera_out1_demux_put);
static int cs47l15_adsp_power_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 cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component);
struct madera_priv *priv = &cs47l15->core;
struct madera *madera = priv->madera;
unsigned int freq;
int ret;
ret = regmap_read(madera->regmap, MADERA_DSP_CLOCK_2, &freq);
if (ret != 0) {
dev_err(madera->dev,
"Failed to read MADERA_DSP_CLOCK_2: %d\n", ret);
return ret;
}
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
ret = madera_set_adsp_clk(&cs47l15->core, w->shift, freq);
if (ret)
return ret;
break;
default:
break;
}
return wm_adsp_early_event(w, kcontrol, event);
}
#define CS47L15_NG_SRC(name, base) \
SOC_SINGLE(name " NG HPOUT1L Switch", base, 0, 1, 0), \
SOC_SINGLE(name " NG HPOUT1R Switch", base, 1, 1, 0), \
SOC_SINGLE(name " NG SPKOUTL Switch", base, 6, 1, 0), \
SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \
SOC_SINGLE(name " NG SPKDAT1R Switch", base, 9, 1, 0)
static int cs47l15_in1_adc_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = !!cs47l15->in1_lp_mode;
return 0;
}
static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component);
if (!!ucontrol->value.integer.value[0] == cs47l15->in1_lp_mode)
return 0;
switch (ucontrol->value.integer.value[0]) {
case 0:
/* Set IN1 to normal mode */
snd_soc_component_update_bits(component, MADERA_DMIC1L_CONTROL,
MADERA_IN1_OSR_MASK,
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/device.h`, `linux/delay.h`, `linux/init.h`, `linux/pm.h`, `linux/pm_runtime.h`, `linux/regmap.h`.
- Detected declarations: `struct cs47l15`, `function cs47l15_adsp_power_ev`, `function cs47l15_in1_adc_get`, `function cs47l15_in1_adc_put`, `function cs47l15_set_fll`, `function cs47l15_open`, `function cs47l15_adsp2_irq`, `function cs47l15_component_probe`, `function cs47l15_component_remove`, `function cs47l15_probe`.
- 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.
- 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.