sound/soc/codecs/max98504.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/max98504.c
Extension
.c
Size
10002 bytes
Lines
383
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 max98504_priv {
	struct regmap *regmap;
	struct regulator_bulk_data supplies[MAX98504_NUM_SUPPLIES];
	unsigned int pcm_rx_channels;
	bool brownout_enable;
	unsigned int brownout_threshold;
	unsigned int brownout_attenuation;
	unsigned int brownout_attack_hold;
	unsigned int brownout_timed_hold;
	unsigned int brownout_release_rate;
};

static const struct reg_default max98504_reg_defaults[] = {
	{ 0x01,	0},
	{ 0x02,	0},
	{ 0x03,	0},
	{ 0x04,	0},
	{ 0x10, 0},
	{ 0x11, 0},
	{ 0x12, 0},
	{ 0x13, 0},
	{ 0x14, 0},
	{ 0x15, 0},
	{ 0x16, 0},
	{ 0x17, 0},
	{ 0x18, 0},
	{ 0x19, 0},
	{ 0x1A, 0},
	{ 0x20, 0},
	{ 0x21, 0},
	{ 0x22, 0},
	{ 0x23, 0},
	{ 0x24, 0},
	{ 0x25, 0},
	{ 0x26, 0},
	{ 0x27, 0},
	{ 0x28, 0},
	{ 0x30, 0},
	{ 0x31, 0},
	{ 0x32, 0},
	{ 0x33, 0},
	{ 0x34, 0},
	{ 0x35, 0},
	{ 0x36, 0},
	{ 0x37, 0},
	{ 0x38, 0},
	{ 0x39, 0},
	{ 0x40, 0},
	{ 0x41, 0},
};

static bool max98504_volatile_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case MAX98504_INTERRUPT_STATUS:
	case MAX98504_INTERRUPT_FLAGS:
	case MAX98504_INTERRUPT_FLAG_CLEARS:
	case MAX98504_WATCHDOG_CLEAR:
	case MAX98504_GLOBAL_ENABLE:
	case MAX98504_SOFTWARE_RESET:
		return true;
	default:
		return false;
	}
}

static bool max98504_readable_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case MAX98504_SOFTWARE_RESET:
	case MAX98504_WATCHDOG_CLEAR:
	case MAX98504_INTERRUPT_FLAG_CLEARS:
		return false;
	default:
		return true;
	}
}

static int max98504_pcm_rx_ev(struct snd_soc_dapm_widget *w,
			      struct snd_kcontrol *kcontrol, int event)
{
	struct snd_soc_component *c = snd_soc_dapm_to_component(w->dapm);
	struct max98504_priv *max98504 = snd_soc_component_get_drvdata(c);

	switch (event) {
	case SND_SOC_DAPM_PRE_PMU:
		regmap_write(max98504->regmap, MAX98504_PCM_RX_ENABLE,
			     max98504->pcm_rx_channels);
		break;
	case SND_SOC_DAPM_POST_PMD:

Annotation

Implementation Notes