sound/soc/codecs/rt5514.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt5514.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt5514.c- Extension
.c- Size
- 39508 bytes
- Lines
- 1336
- 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/acpi.hlinux/fs.hlinux/module.hlinux/moduleparam.hlinux/init.hlinux/delay.hlinux/pm.hlinux/regmap.hlinux/i2c.hlinux/platform_device.hlinux/firmware.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-dapm.hsound/initval.hsound/tlv.hrl6231.hrt5514.hrt5514-spi.h
Detected Declarations
function rt5514_enable_dsp_preparefunction rt5514_volatile_registerfunction rt5514_readable_registerfunction rt5514_i2c_readable_registerfunction rt5514_dsp_voice_wake_up_getfunction rt5514_calibrationfunction rt5514_dsp_voice_wake_up_putfunction rt5514_calc_dmic_clkfunction rt5514_set_dmic_clkfunction rt5514_is_sys_clk_from_pllfunction rt5514_i2s_use_asrcfunction rt5514_hw_paramsfunction rt5514_set_dai_fmtfunction rt5514_set_dai_sysclkfunction rt5514_set_dai_pllfunction rt5514_set_tdm_slotfunction rt5514_set_bias_levelfunction rt5514_probefunction rt5514_i2c_readfunction rt5514_i2c_writefunction rt5514_parse_dpfunction rt5514_i2c_resumefunction rt5514_i2c_probe
Annotated Snippet
if (rt5514->dsp_enabled) {
if (rt5514->pdata.dsp_calib_clk_name &&
!IS_ERR(rt5514->dsp_calib_clk)) {
if (clk_set_rate(rt5514->dsp_calib_clk,
rt5514->pdata.dsp_calib_clk_rate))
dev_err(component->dev,
"Can't set rate for mclk");
if (clk_prepare_enable(rt5514->dsp_calib_clk))
dev_err(component->dev,
"Can't enable dsp_calib_clk");
rt5514_calibration(rt5514, true);
msleep(20);
#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
rt5514_spi_burst_read(RT5514_PLL3_CALIB_CTRL6 |
RT5514_DSP_MAPPING, buf, sizeof(buf));
#else
dev_err(component->dev, "There is no SPI driver for"
" loading the firmware\n");
memset(buf, 0, sizeof(buf));
#endif
rt5514->pll3_cal_value = buf[0] | buf[1] << 8 |
buf[2] << 16 | buf[3] << 24;
rt5514_calibration(rt5514, false);
clk_disable_unprepare(rt5514->dsp_calib_clk);
}
rt5514_enable_dsp_prepare(rt5514);
request_firmware(&fw, RT5514_FIRMWARE1, component->dev);
if (fw) {
#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
rt5514_spi_burst_write(0x4ff60000, fw->data,
((fw->size/8)+1)*8);
#else
dev_err(component->dev, "There is no SPI driver for"
" loading the firmware\n");
#endif
release_firmware(fw);
fw = NULL;
}
request_firmware(&fw, RT5514_FIRMWARE2, component->dev);
if (fw) {
#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
rt5514_spi_burst_write(0x4ffc0000, fw->data,
((fw->size/8)+1)*8);
#else
dev_err(component->dev, "There is no SPI driver for"
" loading the firmware\n");
#endif
release_firmware(fw);
fw = NULL;
}
/* DSP run */
regmap_write(rt5514->i2c_regmap, 0x18002f00,
0x00055148);
if (rt5514->pdata.dsp_calib_clk_name &&
!IS_ERR(rt5514->dsp_calib_clk)) {
msleep(20);
regmap_write(rt5514->i2c_regmap, 0x1800211c,
rt5514->pll3_cal_value);
regmap_write(rt5514->i2c_regmap, 0x18002124,
0x00220012);
regmap_write(rt5514->i2c_regmap, 0x18002124,
0x80220042);
regmap_write(rt5514->i2c_regmap, 0x18002124,
0xe0220042);
}
} else {
regmap_multi_reg_write(rt5514->i2c_regmap,
rt5514_i2c_patch, ARRAY_SIZE(rt5514_i2c_patch));
regcache_mark_dirty(rt5514->regmap);
regcache_sync(rt5514->regmap);
}
}
return 1;
}
static const struct snd_kcontrol_new rt5514_snd_controls[] = {
SOC_DOUBLE_TLV("MIC Boost Volume", RT5514_ANA_CTRL_MICBST,
RT5514_SEL_BSTL_SFT, RT5514_SEL_BSTR_SFT, 8, 0, bst_tlv),
SOC_DOUBLE_R_TLV("ADC1 Capture Volume", RT5514_DOWNFILTER0_CTRL1,
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/fs.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/regmap.h`.
- Detected declarations: `function rt5514_enable_dsp_prepare`, `function rt5514_volatile_register`, `function rt5514_readable_register`, `function rt5514_i2c_readable_register`, `function rt5514_dsp_voice_wake_up_get`, `function rt5514_calibration`, `function rt5514_dsp_voice_wake_up_put`, `function rt5514_calc_dmic_clk`, `function rt5514_set_dmic_clk`, `function rt5514_is_sys_clk_from_pll`.
- 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.