sound/soc/codecs/tda7419.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/tda7419.c
Extension
.c
Size
22036 bytes
Lines
642
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 tda7419_data {
	struct regmap *regmap;
};

static bool tda7419_readable_reg(struct device *dev, unsigned int reg)
{
	return false;
}

static const struct reg_default tda7419_regmap_defaults[] = {
	{ TDA7419_MAIN_SRC_REG,	0xfe },
	{ TDA7419_LOUDNESS_REG, 0xfe },
	{ TDA7419_MUTE_CLK_REG, 0xfe },
	{ TDA7419_VOLUME_REG, 0xfe },
	{ TDA7419_TREBLE_REG, 0xfe },
	{ TDA7419_MIDDLE_REG, 0xfe },
	{ TDA7419_BASS_REG, 0xfe },
	{ TDA7419_SECOND_SRC_REG, 0xfe },
	{ TDA7419_SUB_MID_BASS_REG, 0xfe },
	{ TDA7419_MIXING_GAIN_REG, 0xfe },
	{ TDA7419_ATTENUATOR_LF_REG, 0xfe },
	{ TDA7419_ATTENUATOR_RF_REG, 0xfe },
	{ TDA7419_ATTENUATOR_LR_REG, 0xfe },
	{ TDA7419_ATTENUATOR_RR_REG, 0xfe },
	{ TDA7419_MIXING_LEVEL_REG, 0xfe },
	{ TDA7419_ATTENUATOR_SUB_REG, 0xfe },
	{ TDA7419_SA_CLK_AC_REG, 0xfe },
	{ TDA7419_TESTING_REG, 0xfe },
};

static const struct regmap_config tda7419_regmap_config = {
	.reg_bits = 8,
	.val_bits = 8,
	.max_register = TDA7419_TESTING_REG,
	.cache_type = REGCACHE_RBTREE,
	.readable_reg = tda7419_readable_reg,
	.reg_defaults = tda7419_regmap_defaults,
	.num_reg_defaults = ARRAY_SIZE(tda7419_regmap_defaults),
};

struct tda7419_vol_control {
	int min, max;
	unsigned int reg, rreg, mask, thresh;
	unsigned int invert:1;
};

static inline bool tda7419_vol_is_stereo(struct tda7419_vol_control *tvc)
{
	if (tvc->reg == tvc->rreg)
		return false;

	return true;
}

static int tda7419_vol_info(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_info *uinfo)
{
	struct tda7419_vol_control *tvc =
		(struct tda7419_vol_control *)kcontrol->private_value;

	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = tda7419_vol_is_stereo(tvc) ? 2 : 1;
	uinfo->value.integer.min = tvc->min;
	uinfo->value.integer.max = tvc->max;

	return 0;
}

static inline int tda7419_vol_get_value(int val, unsigned int mask,
					int min, int thresh,
					unsigned int invert)
{
	val &= mask;
	if (val < thresh) {
		if (invert)
			val = 0 - val;
	} else if (val > thresh) {
		if (invert)
			val = val - thresh;
		else
			val = thresh - val;
	}

	if (val < min)
		val = min;

	return val;
}

static int tda7419_vol_get(struct snd_kcontrol *kcontrol,

Annotation

Implementation Notes