sound/soc/codecs/cs47l35.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs47l35.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/cs47l35.c- Extension
.c- Size
- 59976 bytes
- Lines
- 1783
- 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/delay.hlinux/device.hlinux/init.hlinux/module.hlinux/moduleparam.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 cs47l35function cs47l35_adsp_power_evfunction cs47l35_hp_post_enablefunction cs47l35_hp_post_disablefunction cs47l35_hp_evfunction cs47l35_set_fllfunction cs47l35_openfunction cs47l35_adsp2_irqfunction cs47l35_component_probefunction cs47l35_component_removefunction cs47l35_probefunction cs47l35_remove
Annotated Snippet
struct cs47l35 {
struct madera_priv core;
struct madera_fll fll;
};
static const struct cs_dsp_region cs47l35_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 struct cs_dsp_region cs47l35_dsp2_regions[] = {
{ .type = WMFW_ADSP2_PM, .base = 0x100000 },
{ .type = WMFW_ADSP2_ZM, .base = 0x160000 },
{ .type = WMFW_ADSP2_XM, .base = 0x120000 },
{ .type = WMFW_ADSP2_YM, .base = 0x140000 },
};
static const struct cs_dsp_region cs47l35_dsp3_regions[] = {
{ .type = WMFW_ADSP2_PM, .base = 0x180000 },
{ .type = WMFW_ADSP2_ZM, .base = 0x1e0000 },
{ .type = WMFW_ADSP2_XM, .base = 0x1a0000 },
{ .type = WMFW_ADSP2_YM, .base = 0x1c0000 },
};
static const struct cs_dsp_region *cs47l35_dsp_regions[] = {
cs47l35_dsp1_regions,
cs47l35_dsp2_regions,
cs47l35_dsp3_regions,
};
static const int wm_adsp2_control_bases[] = {
MADERA_DSP1_CONFIG_1,
MADERA_DSP2_CONFIG_1,
MADERA_DSP3_CONFIG_1,
};
static const char * const cs47l35_outdemux_texts[] = {
"HPOUT",
"EPOUT",
};
static SOC_ENUM_SINGLE_DECL(cs47l35_outdemux_enum, SND_SOC_NOPM, 0,
cs47l35_outdemux_texts);
static const struct snd_kcontrol_new cs47l35_outdemux =
SOC_DAPM_ENUM_EXT("HPOUT1 Demux", cs47l35_outdemux_enum,
madera_out1_demux_get, madera_out1_demux_put);
static int cs47l35_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 cs47l35 *cs47l35 = snd_soc_component_get_drvdata(component);
struct madera_priv *priv = &cs47l35->core;
struct madera *madera = priv->madera;
unsigned int freq;
int ret;
ret = regmap_read(madera->regmap, MADERA_DSP_CLOCK_1, &freq);
if (ret != 0) {
dev_err(madera->dev,
"Failed to read MADERA_DSP_CLOCK_1: %d\n", ret);
return ret;
}
freq &= MADERA_DSP_CLK_FREQ_LEGACY_MASK;
freq >>= MADERA_DSP_CLK_FREQ_LEGACY_SHIFT;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
ret = madera_set_adsp_clk(&cs47l35->core, w->shift, freq);
if (ret)
return ret;
break;
default:
break;
}
return wm_adsp_early_event(w, kcontrol, event);
}
#define CS47L35_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 SPKOUT Switch", base, 6, 1, 0), \
SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/init.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/pm.h`, `linux/pm_runtime.h`, `linux/regmap.h`.
- Detected declarations: `struct cs47l35`, `function cs47l35_adsp_power_ev`, `function cs47l35_hp_post_enable`, `function cs47l35_hp_post_disable`, `function cs47l35_hp_ev`, `function cs47l35_set_fll`, `function cs47l35_open`, `function cs47l35_adsp2_irq`, `function cs47l35_component_probe`, `function cs47l35_component_remove`.
- 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.