sound/soc/codecs/rt722-sdca.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt722-sdca.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt722-sdca.c- Extension
.c- Size
- 58467 bytes
- Lines
- 1913
- 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.
- 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/bitops.hlinux/delay.hlinux/dmi.hlinux/firmware.hlinux/init.hlinux/kernel.hlinux/module.hlinux/moduleparam.hlinux/pm_runtime.hlinux/slab.hlinux/soundwire/sdw_registers.hsound/core.hsound/initval.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc-dapm.hsound/tlv.hrt722-sdca.h
Detected Declarations
function rt722_sdca_index_writefunction rt722_sdca_index_readfunction rt722_sdca_index_update_bitsfunction rt722_sdca_btn_typefunction rt722_sdca_button_detectfunction rt722_sdca_headset_detectfunction rt722_sdca_jack_detect_handlerfunction rt722_sdca_btn_check_handlerfunction rt722_sdca_jack_initfunction rt722_sdca_set_jack_detectfunction rt722_cae_loadfunction rt722_cae_update_putfunction rt722_cae_update_getfunction rt722_sdca_set_gain_putfunction rt722_sdca_set_gain_getfunction rt722_sdca_set_fu1e_capture_ctlfunction rt722_sdca_fu1e_capture_getfunction rt722_sdca_fu1e_capture_putfunction rt722_sdca_set_fu06_playback_ctlfunction rt722_sdca_fu06_playback_getfunction rt722_sdca_fu06_playback_putfunction rt722_sdca_set_fu0f_capture_ctlfunction rt722_sdca_fu0f_capture_getfunction rt722_sdca_fu0f_capture_putfunction rt722_sdca_fu_infofunction rt722_sdca_dmic_set_gain_getfunction rt722_sdca_dmic_set_gain_putfunction rt722_sdca_fu42_eventfunction rt722_sdca_fu21_eventfunction rt722_sdca_fu113_eventfunction rt722_sdca_fu36_eventfunction rt722_pde_transition_delayfunction rt722_sdca_pde47_eventfunction rt722_sdca_pde23_eventfunction rt722_sdca_pde11_eventfunction rt722_sdca_pde12_eventfunction rt722_sdca_parse_dtfunction rt722_sdca_probefunction rt722_sdca_set_sdw_streamfunction rt722_sdca_shutdownfunction rt722_sdca_pcm_hw_paramsfunction rt722_sdca_pcm_hw_freefunction rt722_sdca_initfunction rt722_sdca_dmic_presetfunction rt722_sdca_amp_presetfunction rt722_sdca_jack_presetfunction rt722_sdca_io_init
Annotated Snippet
if (ret != -EACCES) {
dev_err(component->dev, "%s: failed to resume %d\n", __func__, ret);
return ret;
}
/* pm_runtime not enabled yet */
dev_dbg(component->dev, "%s: skipping jack init for now\n", __func__);
return 0;
}
rt722_sdca_jack_init(rt722);
pm_runtime_put_autosuspend(component->dev);
return 0;
}
static int rt722_cae_load(struct rt722_sdca_priv *rt722)
{
struct device *dev = &rt722->slave->dev;
static const char func_tag[] = "FUNC";
static const char xu_tag[] = "XU";
const char *dmi_vendor, *dmi_product, *dmi_sku;
char *cae_filename;
const struct firmware *cae_fw = NULL;
unsigned int cae_st_spk, cae_st_hp, cae_st_mic;
unsigned int func, value;
unsigned int combined_val;
unsigned int addr, size;
unsigned int fw_offset;
unsigned char mbq_high_val = 0;
unsigned char *param_data;
unsigned char *fw_data;
char tag[5];
char *space;
int v_len, p_len, s_len;
int ret = 0, i;
int retry = 50;
dmi_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
dmi_product = dmi_get_system_info(DMI_PRODUCT_NAME);
dmi_sku = dmi_get_system_info(DMI_PRODUCT_SKU);
if (!dmi_vendor || !dmi_product || !dmi_sku) {
dev_warn(dev, "%s: Incomplete DMI info\n", __func__);
return -EINVAL;
}
space = strchr(dmi_vendor, ' ');
v_len = space ? space - dmi_vendor : strlen(dmi_vendor);
space = strchr(dmi_product, ' ');
p_len = space ? space - dmi_product : strlen(dmi_product);
space = strchr(dmi_sku, ' ');
s_len = space ? space - dmi_sku : strlen(dmi_sku);
cae_filename = kasprintf(GFP_KERNEL,
"realtek/rt722/rt722_RAE_%.*s_%.*s_%.*s.dat",
v_len, dmi_vendor,
p_len, dmi_product,
s_len, dmi_sku);
if (!cae_filename)
return -ENOMEM;
dev_dbg(dev, "%s: try to load CAE file %s\n", __func__, cae_filename);
regmap_write(rt722->regmap, RT722_SPK_CAE_PARAM1, 0x5f);
regmap_write(rt722->regmap, RT722_HP_CAE_PARAM39, 0x5f);
regmap_write(rt722->regmap, RT722_MIC_CAE_PARAM39, 0x5f);
usleep_range(50000, 60000);
request_firmware(&cae_fw, cae_filename, dev);
kfree(cae_filename);
if (!cae_fw) {
dev_err(dev, "%s: Failed to load CAE firmware\n", __func__);
return -ENOENT;
}
regmap_read(rt722->regmap, RT722_SPK_CAE_PARAM38, &cae_st_spk);
regmap_read(rt722->regmap, RT722_HP_CAE_PARAM68, &cae_st_hp);
regmap_read(rt722->regmap, RT722_MIC_CAE_PARAM99, &cae_st_mic);
cae_st_spk &= 0x80;
cae_st_hp &= 0x80;
cae_st_mic &= 0x80;
dev_dbg(dev, "%s(%d) spk_crc:%x, hp_crc:%x, mic_crc:%x\n",
__func__, __LINE__, cae_st_spk, cae_st_hp, cae_st_mic);
if (cae_st_spk)
rt722_sdca_index_update_bits(rt722, RT722_VENDOR_EQ_CAE,
RT722_EQ_CTRL_SPK, 0x0008, 0x0008);
else if (cae_st_hp)
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/delay.h`, `linux/dmi.h`, `linux/firmware.h`, `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`.
- Detected declarations: `function rt722_sdca_index_write`, `function rt722_sdca_index_read`, `function rt722_sdca_index_update_bits`, `function rt722_sdca_btn_type`, `function rt722_sdca_button_detect`, `function rt722_sdca_headset_detect`, `function rt722_sdca_jack_detect_handler`, `function rt722_sdca_btn_check_handler`, `function rt722_sdca_jack_init`, `function rt722_sdca_set_jack_detect`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.