sound/soc/codecs/wm8997.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/wm8997.c
Extension
.c
Size
42343 bytes
Lines
1222
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 wm8997_priv {
	struct arizona_priv core;
	struct arizona_fll fll[2];
};

static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);

static const struct reg_default wm8997_sysclk_reva_patch[] = {
	{ 0x301D, 0x7B15 },
	{ 0x301B, 0x0050 },
	{ 0x305D, 0x7B17 },
	{ 0x305B, 0x0050 },
	{ 0x3001, 0x08FE },
	{ 0x3003, 0x00F4 },
	{ 0x3041, 0x08FF },
	{ 0x3043, 0x0005 },
	{ 0x3020, 0x0225 },
	{ 0x3021, 0x0A00 },
	{ 0x3022, 0xE24D },
	{ 0x3023, 0x0800 },
	{ 0x3024, 0xE24D },
	{ 0x3025, 0xF000 },
	{ 0x3060, 0x0226 },
	{ 0x3061, 0x0A00 },
	{ 0x3062, 0xE252 },
	{ 0x3063, 0x0800 },
	{ 0x3064, 0xE252 },
	{ 0x3065, 0xF000 },
	{ 0x3116, 0x022B },
	{ 0x3117, 0xFA00 },
	{ 0x3110, 0x246C },
	{ 0x3111, 0x0A03 },
	{ 0x3112, 0x246E },
	{ 0x3113, 0x0A03 },
	{ 0x3114, 0x2470 },
	{ 0x3115, 0x0A03 },
	{ 0x3126, 0x246C },
	{ 0x3127, 0x0A02 },
	{ 0x3128, 0x246E },
	{ 0x3129, 0x0A02 },
	{ 0x312A, 0x2470 },
	{ 0x312B, 0xFA02 },
	{ 0x3125, 0x0800 },
};

static int wm8997_sysclk_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 arizona *arizona = dev_get_drvdata(component->dev->parent);
	struct regmap *regmap = arizona->regmap;
	const struct reg_default *patch = NULL;
	int i, patch_size;

	switch (arizona->rev) {
	case 0:
		patch = wm8997_sysclk_reva_patch;
		patch_size = ARRAY_SIZE(wm8997_sysclk_reva_patch);
		break;
	default:
		break;
	}

	switch (event) {
	case SND_SOC_DAPM_POST_PMU:
		if (patch)
			for (i = 0; i < patch_size; i++)
				regmap_write_async(regmap, patch[i].reg,
						   patch[i].def);
		break;
	case SND_SOC_DAPM_PRE_PMD:
		break;
	case SND_SOC_DAPM_PRE_PMU:
	case SND_SOC_DAPM_POST_PMD:
		return arizona_clk_ev(w, kcontrol, event);
	default:
		return 0;
	}

	return arizona_dvfs_sysclk_ev(w, kcontrol, event);
}

static const char * const wm8997_osr_text[] = {
	"Low power", "Normal", "High performance",
};

Annotation

Implementation Notes