sound/soc/codecs/tac5xx2-sdw.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/tac5xx2-sdw.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/tac5xx2-sdw.c- Extension
.c- Size
- 57864 bytes
- Lines
- 2038
- 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.
- 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.
- 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/err.hlinux/firmware.hlinux/init.hlinux/module.hlinux/pci.hlinux/pm.hlinux/pm_runtime.hlinux/regmap.hlinux/soundwire/sdw.hlinux/soundwire/sdw_registers.hlinux/soundwire/sdw_type.hlinux/time.hlinux/unaligned.hsound/pcm_params.hsound/sdw.hsound/soc.hsound/tlv.hsound/sdca_asoc.hsound/sdca_function.hsound/sdca_regmap.hsound/jack.htac5xx2.h
Detected Declarations
struct tac_fw_hdrstruct tac_fw_filestruct tac5xx2_prvfunction tac_volatile_regfunction tac_sdca_mbq_sizefunction tac_has_dsp_algofunction tac_has_uaj_supportfunction tac_set_sdw_streamfunction tac_sdw_shutdownfunction tac_clear_latchfunction tac_sdw_hw_paramsfunction tac_sdw_pcm_hw_freefunction tac5xx2_sdca_btn_typefunction tac5xx2_sdca_button_detectfunction tac5xx2_sdca_headset_detectfunction tac5xx2_jack_initfunction tac5xx2_set_jackfunction tac_interrupt_callbackfunction tac_component_probefunction tac_component_removefunction tac_initfunction tac5xx2_sdca_dev_suspendfunction tac5xx2_sdca_dev_system_suspendfunction tac5xx2_sdca_dev_resumefunction tac_fw_read_hdrfunction tac_fw_get_next_filefunction tac5xx2_fw_readyfunction tac_load_and_cache_firmware_asyncfunction tac_downloadfunction tac_download_fw_to_hwfunction tac_generate_fw_namefunction tac_io_initfunction tac_update_statusfunction tac5xx2_sdw_read_propfunction tac_port_prepfunction tac_sdw_probefunction tac_sdw_remove
Annotated Snippet
struct tac_fw_hdr {
u32 size;
u32 version_offset;
u32 plt_id;
u32 ppc3_ver;
u64 timestamp;
u8 ddc_name[64];
};
/* Firmware file/chunk structure */
struct tac_fw_file {
u32 vendor_id;
u32 file_id;
u32 version;
u32 length;
u32 dest_addr;
u8 *fw_data;
};
/* TLV for volume control */
static const DECLARE_TLV_DB_SCALE(tac5xx2_amp_tlv, 0, 50, 0);
static const DECLARE_TLV_DB_SCALE(tac5xx2_dvc_tlv, -7200, 50, 0);
/* Q7.8 volume control parameters: range -72dB to +6dB, step 0.5dB */
#define TAC_DVC_STEP 128 /* 0.5 dB in Q7.8 format */
#define TAC_DVC_MIN (-144) /* -72 dB / 0.5 dB step */
#define TAC_DVC_MAX 12 /* +6 dB / 0.5 dB step */
/* TAC-specific stereo volume control macro using SDW_SDCA_CTL (single control for L/R) */
#define TAC_DOUBLE_Q78_TLV(name, func_id, ent_id) \
SDCA_DOUBLE_Q78_TLV(name, \
SDW_SDCA_CTL(TAC_FUNCTION_ID_##func_id, TAC_SDCA_ENT_##ent_id, \
TAC_SDCA_CHANNEL_GAIN, TAC_CHANNEL_LEFT), \
SDW_SDCA_CTL(TAC_FUNCTION_ID_##func_id, TAC_SDCA_ENT_##ent_id, \
TAC_SDCA_CHANNEL_GAIN, TAC_CHANNEL_RIGHT), \
TAC_DVC_MIN, TAC_DVC_MAX, TAC_DVC_STEP, tac5xx2_dvc_tlv)
struct tac5xx2_prv {
struct snd_soc_component *component;
struct sdw_slave *sdw_peripheral;
struct sdca_function_data *sa_func_data;
struct sdca_function_data *sm_func_data;
struct sdca_function_data *uaj_func_data;
struct sdca_function_data *hid_func_data;
enum sdw_slave_status status;
struct regmap *regmap;
struct device *dev;
bool hw_init;
bool first_hw_init_done;
u32 part_id;
struct snd_soc_jack *hs_jack;
int jack_type;
/* Custom fw binary. UMP File Download is not used. */
unsigned int fw_file_cnt;
struct tac_fw_file *fw_files;
struct completion fw_caching_complete;
bool fw_dl_success;
u8 fw_binaryname[64];
};
static const struct reg_default tac_reg_default[] = {
{TAC_SW_RESET, 0x0},
{TAC_SLEEP_MODEZ, 0x0},
{TAC_FEATURE_PDZ, 0x0},
{TAC_TX_CH_EN, 0xf0},
{TAC_REG_SDW(0, 0, 0x5), 0xcf},
{TAC_REG_SDW(0, 0, 0x6), 0xa},
{TAC_REG_SDW(0, 0, 0x7), 0x0},
{TAC_REG_SDW(0, 0, 0x8), 0xfe},
{TAC_REG_SDW(0, 0, 0x9), 0x9},
{TAC_REG_SDW(0, 0, 0xa), 0x28},
{TAC_REG_SDW(0, 0, 0xb), 0x1},
{TAC_REG_SDW(0, 0, 0xc), 0x11},
{TAC_REG_SDW(0, 0, 0xd), 0x11},
{TAC_REG_SDW(0, 0, 0xe), 0x61},
{TAC_REG_SDW(0, 0, 0xf), 0x0},
{TAC_REG_SDW(0, 0, 0x10), 0x50},
{TAC_REG_SDW(0, 0, 0x11), 0x70},
{TAC_REG_SDW(0, 0, 0x12), 0x60},
{TAC_REG_SDW(0, 0, 0x13), 0x28},
{TAC_REG_SDW(0, 0, 0x14), 0x0},
{TAC_REG_SDW(0, 0, 0x15), 0x18},
{TAC_REG_SDW(0, 0, 0x16), 0x20},
{TAC_REG_SDW(0, 0, 0x17), 0x0},
{TAC_REG_SDW(0, 0, 0x18), 0x18},
{TAC_REG_SDW(0, 0, 0x19), 0x54},
{TAC_REG_SDW(0, 0, 0x1a), 0x8},
{TAC_REG_SDW(0, 0, 0x1b), 0x0},
{TAC_REG_SDW(0, 0, 0x1c), 0x30},
{TAC_REG_SDW(0, 0, 0x1d), 0x0},
Annotation
- Immediate include surface: `linux/err.h`, `linux/firmware.h`, `linux/init.h`, `linux/module.h`, `linux/pci.h`, `linux/pm.h`, `linux/pm_runtime.h`, `linux/regmap.h`.
- Detected declarations: `struct tac_fw_hdr`, `struct tac_fw_file`, `struct tac5xx2_prv`, `function tac_volatile_reg`, `function tac_sdca_mbq_size`, `function tac_has_dsp_algo`, `function tac_has_uaj_support`, `function tac_set_sdw_stream`, `function tac_sdw_shutdown`, `function tac_clear_latch`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
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.