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.
- 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/crc8.hlinux/firmware.hlinux/gpio/consumer.hlinux/i2c.hlinux/init.hlinux/interrupt.hlinux/module.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/regmap.hlinux/slab.hsound/pcm_params.hsound/soc.hsound/tas2781.hsound/tas2781-comlib-i2c.hsound/tlv.hsound/tas2x20-tlv.hsound/tas2563-tlv.hsound/tas2781-tlv.hsound/tas5825-tlv.hlinux/unaligned.h
Detected Declarations
function tas2781_digital_getvolfunction tas2781_digital_putvolfunction tas2781_amp_getvolfunction tas2781_amp_putvolfunction tasdev_force_fwload_getfunction tasdev_force_fwload_putfunction tasdev_cali_data_getfunction calib_data_getfunction partial_cali_data_updatefunction sngl_calib_startfunction tas2781_calib_start_putfunction tas2781_calib_stop_putfunction tas2563_calib_start_putfunction tas2563_calib_stop_putfunction tasdev_calib_stop_putfunction tasdev_cali_data_putfunction tas2781_latch_reg_getfunction tasdev_tf_data_getfunction tasdev_re_data_getfunction tasdev_r0_data_getfunction tasdev_XMA1_data_getfunction tasdev_XMA2_data_getfunction tasdev_nop_getfunction tasdevice_digital_gain_getfunction tasdevice_digital_gain_putfunction tasdevice_set_profile_idfunction tasdevice_info_active_numfunction tasdevice_info_chip_idfunction tasdevice_info_programsfunction tasdevice_info_configurationsfunction tasdevice_info_profilefunction tasdevice_get_profile_idfunction tasdevice_get_chip_idfunction tasdevice_create_controlfunction tasdevice_program_getfunction tasdevice_program_putfunction tasdevice_configuration_getfunction tasdevice_configuration_putfunction tasdevice_active_num_getfunction tasdevice_active_num_putfunction tasdevice_dsp_create_ctrlsfunction cali_reg_updatefunction alpa_cali_updatefunction tasdevice_create_cali_ctrlsfunction lenfunction acoustic_ctl_writefunction tasdevice_fw_readyfunction tasdevice_dapm_event
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
- Immediate include surface: `linux/crc8.h`, `linux/firmware.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/init.h`, `linux/interrupt.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `function tas2781_digital_getvol`, `function tas2781_digital_putvol`, `function tas2781_amp_getvol`, `function tas2781_amp_putvol`, `function tasdev_force_fwload_get`, `function tasdev_force_fwload_put`, `function tasdev_cali_data_get`, `function calib_data_get`, `function partial_cali_data_update`, `function sngl_calib_start`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.