sound/soc/codecs/cs47l85.c

Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs47l85.c

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/cs47l85.c
Extension
.c
Size
99725 bytes
Lines
2734
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct cs47l85 {
	struct madera_priv core;
	struct madera_fll fll[3];
};

static const struct cs_dsp_region cs47l85_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 cs47l85_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 cs47l85_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 cs47l85_dsp4_regions[] = {
	{ .type = WMFW_ADSP2_PM, .base = 0x200000 },
	{ .type = WMFW_ADSP2_ZM, .base = 0x260000 },
	{ .type = WMFW_ADSP2_XM, .base = 0x220000 },
	{ .type = WMFW_ADSP2_YM, .base = 0x240000 },
};

static const struct cs_dsp_region cs47l85_dsp5_regions[] = {
	{ .type = WMFW_ADSP2_PM, .base = 0x280000 },
	{ .type = WMFW_ADSP2_ZM, .base = 0x2e0000 },
	{ .type = WMFW_ADSP2_XM, .base = 0x2a0000 },
	{ .type = WMFW_ADSP2_YM, .base = 0x2c0000 },
};

static const struct cs_dsp_region cs47l85_dsp6_regions[] = {
	{ .type = WMFW_ADSP2_PM, .base = 0x300000 },
	{ .type = WMFW_ADSP2_ZM, .base = 0x360000 },
	{ .type = WMFW_ADSP2_XM, .base = 0x320000 },
	{ .type = WMFW_ADSP2_YM, .base = 0x340000 },
};

static const struct cs_dsp_region cs47l85_dsp7_regions[] = {
	{ .type = WMFW_ADSP2_PM, .base = 0x380000 },
	{ .type = WMFW_ADSP2_ZM, .base = 0x3e0000 },
	{ .type = WMFW_ADSP2_XM, .base = 0x3a0000 },
	{ .type = WMFW_ADSP2_YM, .base = 0x3c0000 },
};

static const struct cs_dsp_region *cs47l85_dsp_regions[] = {
	cs47l85_dsp1_regions,
	cs47l85_dsp2_regions,
	cs47l85_dsp3_regions,
	cs47l85_dsp4_regions,
	cs47l85_dsp5_regions,
	cs47l85_dsp6_regions,
	cs47l85_dsp7_regions,
};

static const unsigned int wm_adsp2_control_bases[] = {
	MADERA_DSP1_CONFIG_1,
	MADERA_DSP2_CONFIG_1,
	MADERA_DSP3_CONFIG_1,
	MADERA_DSP4_CONFIG_1,
	MADERA_DSP5_CONFIG_1,
	MADERA_DSP6_CONFIG_1,
	MADERA_DSP7_CONFIG_1,
};

static int cs47l85_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 cs47l85 *cs47l85 = snd_soc_component_get_drvdata(component);
	struct madera_priv *priv = &cs47l85->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);

Annotation

Implementation Notes