sound/soc/codecs/tas2781-i2c.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/tas2781-i2c.c
Extension
.c
Size
61093 bytes
Lines
2136
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern 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

static const struct file_operations acoustic_ctl_fops = {
	.open = simple_open,
	.read = acoustic_ctl_read,
	.write = acoustic_ctl_write,
};
#endif

static void tasdevice_fw_ready(const struct firmware *fmw,
	void *context)
{
	struct tasdevice_priv *tas_priv = context;
#ifdef CONFIG_SND_SOC_TAS2781_ACOUST_I2C
	struct snd_soc_component *comp = tas_priv->codec;
	struct dentry *debugfs_root = comp->debugfs_root;
	char *acoustic_debugfs_node;
#endif
	int ret = 0;
	int i;

	mutex_lock(&tas_priv->codec_lock);

	ret = tasdevice_rca_parser(tas_priv, fmw);
	if (ret) {
		tasdevice_config_info_remove(tas_priv);
		goto out;
	}
	tasdevice_create_control(tas_priv);

	tasdevice_dsp_remove(tas_priv);
	tasdevice_calbin_remove(tas_priv);
	/*
	 * The baseline is the RCA-only case, and then the code attempts to
	 * load DSP firmware but in case of failures just keep going, i.e.
	 * failing to load DSP firmware is NOT an error.
	 */
	tas_priv->fw_state = TASDEVICE_RCA_FW_OK;
	/* There is no DSP firmware required for TAS2118/2X20/257X. */
	switch (tas_priv->chip_id) {
	case TAS2020:
	case TAS2118:
	case TAS2120:
	case TAS2320:
	case TAS2568:
	case TAS2570:
	case TAS2572:
	case TAS2574:
		goto out;
	}
	if (tas_priv->name_prefix)
		scnprintf(tas_priv->coef_binaryname, 64, "%s-%s_coef.bin",
			tas_priv->name_prefix, tas_priv->dev_name);
	else
		scnprintf(tas_priv->coef_binaryname, 64, "%s_coef.bin",
			tas_priv->dev_name);
	ret = tasdevice_dsp_parser(tas_priv);
	if (ret) {
		dev_err(tas_priv->dev, "dspfw load %s error\n",
			tas_priv->coef_binaryname);
		goto out;
	}

	/*
	 * If no dsp-related kcontrol created, the dsp resource will be freed.
	 */
	ret = tasdevice_dsp_create_ctrls(tas_priv);
	if (ret) {
		dev_err(tas_priv->dev, "dsp controls error\n");
		goto out;
	}
	tas_priv->fw_state = TASDEVICE_DSP_FW_ALL_OK;

	/* There is no calibration required for TAS58XX. */
	if (tas_priv->chip_id == TAS2563 || tas_priv->chip_id == TAS2781) {
		ret = tasdevice_create_cali_ctrls(tas_priv);
		if (ret) {
			dev_err(tas_priv->dev, "cali controls error\n");
			goto out;
		}
		/* If calibrated data occurs error, dsp will still works
		 * with default calibrated data inside algo.
		 */
		for (i = 0; i < tas_priv->ndev; i++) {
			if (tas_priv->name_prefix)
				scnprintf(tas_priv->cal_binaryname[i], 64,
					  "%s-%s_cal_0x%02x.bin",
					  tas_priv->name_prefix,
					  tas_priv->dev_name,
					  tas_priv->tasdevice[i].dev_addr);
			else
				scnprintf(tas_priv->cal_binaryname[i], 64,

Annotation

Implementation Notes