sound/hda/codecs/side-codecs/cs35l41_hda.c
Source file repositories/reference/linux-study-clean/sound/hda/codecs/side-codecs/cs35l41_hda.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/codecs/side-codecs/cs35l41_hda.c- Extension
.c- Size
- 59349 bytes
- Lines
- 2131
- Domain
- Driver Families
- Bucket
- sound/hda
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/acpi.hlinux/module.hlinux/moduleparam.hsound/hda_codec.hsound/soc.hlinux/pm_runtime.hlinux/spi/spi.hlinux/vmalloc.hhda_local.hhda_auto_parser.hhda_jack.h../generic.hhda_component.hcs35l41_hda.hcs35l41_hda_property.h
Detected Declarations
struct cs35l41_tuning_param_hdrstruct cs35l41_tuning_paramstruct cs35l41_tuning_paramsenum cs35l41_tuning_param_typesenum cs35l41_hda_fw_idfunction cs35l41_request_tuning_param_filefunction cs35l41_request_firmware_filefunction cs35l41_request_firmware_files_spkidfunction cs35l41_fallback_firmware_filefunction cs35l41_request_firmware_filesfunction cs35l41_hda_apply_calibrationfunction cs35l41_read_silicon_uidfunction cs35l41_get_calibrationfunction cs35l41_set_default_tuning_paramsfunction cs35l41_read_tuning_paramsfunction cs35l41_load_tuning_paramsfunction cs35l41_init_dspfunction cs35l41_shutdown_dspfunction cs35l41_remove_dspfunction cs35l41_error_releasefunction cs35l41_irq_releasefunction cs35l41_update_mixerfunction cs35l41_hda_play_startfunction cs35l41_mutefunction cs35l41_hda_play_donefunction cs35l41_hda_pause_startfunction cs35l41_hda_pause_donefunction cs35l41_hda_pre_playback_hookfunction cs35l41_hda_playback_hookfunction scoped_guardfunction scoped_guardfunction scoped_guardfunction cs35l41_hda_post_playback_hookfunction cs35l41_hda_channel_mapfunction cs35l41_verify_idfunction cs35l41_ready_for_resetfunction cs35l41_system_suspend_prepfunction cs35l41_system_suspendfunction scoped_guardfunction cs35l41_wait_boot_donefunction cs35l41_system_resumefunction cs35l41_runtime_idlefunction cs35l41_runtime_suspendfunction cs35l41_runtime_resumefunction cs35l41_hda_read_ctlfunction cs35l41_smart_ampfunction cs35l41_load_firmwarefunction cs35l41_fw_load_ctl_get
Annotated Snippet
struct cs35l41_tuning_param_hdr {
__le32 tuning_index;
__le32 type;
__le32 size;
} __packed;
struct cs35l41_tuning_param {
struct cs35l41_tuning_param_hdr hdr;
union {
__le32 gain;
};
} __packed;
struct cs35l41_tuning_params {
__le32 signature;
__le32 version;
__le32 size;
__le32 num_entries;
u8 data[];
} __packed;
/* Firmware calibration controls */
static const struct cirrus_amp_cal_controls cs35l41_calibration_controls = {
.alg_id = CAL_DSP_CTL_ALG,
.mem_region = CAL_DSP_CTL_TYPE,
.ambient = CAL_AMBIENT_DSP_CTL_NAME,
.calr = CAL_R_DSP_CTL_NAME,
.status = CAL_STATUS_DSP_CTL_NAME,
.checksum = CAL_CHECKSUM_DSP_CTL_NAME,
};
enum cs35l41_hda_fw_id {
CS35L41_HDA_FW_SPK_PROT,
CS35L41_HDA_FW_SPK_CALI,
CS35L41_HDA_FW_SPK_DIAG,
CS35L41_HDA_FW_MISC,
CS35L41_HDA_NUM_FW
};
static const char * const cs35l41_hda_fw_ids[CS35L41_HDA_NUM_FW] = {
[CS35L41_HDA_FW_SPK_PROT] = "spk-prot",
[CS35L41_HDA_FW_SPK_CALI] = "spk-cali",
[CS35L41_HDA_FW_SPK_DIAG] = "spk-diag",
[CS35L41_HDA_FW_MISC] = "misc",
};
static bool firmware_autostart = 1;
module_param(firmware_autostart, bool, 0444);
MODULE_PARM_DESC(firmware_autostart, "Allow automatic firmware download on boot"
"(0=Disable, 1=Enable) (default=1); ");
static const char channel_name[3] = { 'L', 'R', 'C' };
static const struct reg_sequence cs35l41_hda_config[] = {
{ CS35L41_PLL_CLK_CTRL, 0x00000430 }, // 3072000Hz, BCLK Input, PLL_REFCLK_EN = 1
{ CS35L41_DSP_CLK_CTRL, 0x00000003 }, // DSP CLK EN
{ CS35L41_GLOBAL_CLK_CTRL, 0x00000003 }, // GLOBAL_FS = 48 kHz
{ CS35L41_SP_RATE_CTRL, 0x00000021 }, // ASP_BCLK_FREQ = 3.072 MHz
{ CS35L41_SP_FORMAT, 0x20200200 }, // 32 bits RX/TX slots, I2S, clk consumer
{ CS35L41_SP_TX_WL, 0x00000018 }, // 24 cycles/slot
{ CS35L41_SP_RX_WL, 0x00000018 }, // 24 cycles/slot
{ CS35L41_ASP_TX1_SRC, 0x00000018 }, // ASPTX1 SRC = VMON
{ CS35L41_ASP_TX2_SRC, 0x00000019 }, // ASPTX2 SRC = IMON
{ CS35L41_DSP1_RX3_SRC, 0x00000018 }, // DSP1RX3 SRC = VMON
{ CS35L41_DSP1_RX4_SRC, 0x00000019 }, // DSP1RX4 SRC = IMON
};
static const struct reg_sequence cs35l41_hda_config_no_dsp[] = {
{ CS35L41_SP_HIZ_CTRL, 0x00000002 }, // Hi-Z unused
{ CS35L41_DAC_PCM1_SRC, 0x00000008 }, // DACPCM1_SRC = ASPRX1
{ CS35L41_ASP_TX3_SRC, 0x00000000 }, // ASPTX3 SRC = ZERO FILL
{ CS35L41_ASP_TX4_SRC, 0x00000000 }, // ASPTX4 SRC = ZERO FILL
{ CS35L41_DSP1_RX5_SRC, 0x00000020 }, // DSP1RX5 SRC = ERRVOL
{ CS35L41_DSP1_RX6_SRC, 0x00000021 }, // DSP1RX6 SRC = CLASSH_TGT
};
static const struct reg_sequence cs35l41_hda_config_dsp[] = {
{ CS35L41_SP_HIZ_CTRL, 0x00000003 }, // Hi-Z unused/disabled
{ CS35L41_DAC_PCM1_SRC, 0x00000032 }, // DACPCM1_SRC = DSP1TX1
{ CS35L41_ASP_TX3_SRC, 0x00000028 }, // ASPTX3 SRC = VPMON
{ CS35L41_ASP_TX4_SRC, 0x00000029 }, // ASPTX4 SRC = VBSTMON
{ CS35L41_DSP1_RX6_SRC, 0x00000029 }, // DSP1RX6 SRC = VBSTMON
};
static const struct reg_sequence cs35l41_hda_unmute[] = {
{ CS35L41_AMP_DIG_VOL_CTRL, 0x00008000 }, // AMP_HPF_PCM_EN = 1, AMP_VOL_PCM 0.0 dB
{ CS35L41_AMP_GAIN_CTRL, 0x00000084 }, // AMP_GAIN_PCM 4.5 dB
};
static const struct reg_sequence cs35l41_hda_mute[] = {
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/module.h`, `linux/moduleparam.h`, `sound/hda_codec.h`, `sound/soc.h`, `linux/pm_runtime.h`, `linux/spi/spi.h`, `linux/vmalloc.h`.
- Detected declarations: `struct cs35l41_tuning_param_hdr`, `struct cs35l41_tuning_param`, `struct cs35l41_tuning_params`, `enum cs35l41_tuning_param_types`, `enum cs35l41_hda_fw_id`, `function cs35l41_request_tuning_param_file`, `function cs35l41_request_firmware_file`, `function cs35l41_request_firmware_files_spkid`, `function cs35l41_fallback_firmware_file`, `function cs35l41_request_firmware_files`.
- Atlas domain: Driver Families / sound/hda.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.