sound/soc/codecs/rt721-sdca.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt721-sdca.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt721-sdca.c- Extension
.c- Size
- 49096 bytes
- Lines
- 1562
- 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.hsound/core.hlinux/delay.hlinux/init.hsound/initval.hsound/jack.hlinux/kernel.hlinux/module.hlinux/moduleparam.hsound/pcm.hlinux/pm_runtime.hsound/pcm_params.hlinux/soundwire/sdw_registers.hlinux/slab.hsound/soc-dapm.hsound/tlv.hrt721-sdca.hrt-sdw-common.h
Detected Declarations
function rt721_sdca_jack_detect_handlerfunction rt721_sdca_btn_check_handlerfunction rt721_sdca_dmic_presetfunction rt721_sdca_amp_presetfunction rt721_sdca_jack_presetfunction rt721_sdca_jack_initfunction rt721_sdca_set_jack_detectfunction rt721_sdca_set_gain_putfunction rt721_sdca_set_gain_getfunction rt721_sdca_set_fu1e_capture_ctlfunction rt721_sdca_fu1e_capture_getfunction rt721_sdca_fu1e_capture_putfunction rt721_sdca_set_fu0f_capture_ctlfunction rt721_sdca_fu0f_capture_getfunction rt721_sdca_fu0f_capture_putfunction rt721_sdca_fu_infofunction rt721_sdca_dmic_set_gain_getfunction rt721_sdca_dmic_set_gain_putfunction rt721_sdca_adc_mux_getfunction rt721_sdca_adc_mux_putfunction rt721_sdca_fu42_eventfunction rt721_sdca_fu21_eventfunction rt721_sdca_fu23_eventfunction rt721_sdca_fu113_eventfunction rt721_sdca_fu36_eventfunction rt721_sdca_pde47_eventfunction rt721_sdca_pde41_eventfunction rt721_sdca_pde11_eventfunction rt721_sdca_pde34_eventfunction rt721_sdca_parse_dtfunction rt721_sdca_probefunction rt721_sdca_set_sdw_streamfunction rt721_sdca_shutdownfunction rt721_sdca_pcm_hw_paramsfunction rt721_sdca_pcm_hw_freefunction rt721_sdca_initfunction rt721_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;
}
rt721_sdca_jack_init(rt721);
pm_runtime_put_autosuspend(component->dev);
return 0;
}
/* For SDCA control DAC/ADC Gain */
static int rt721_sdca_set_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
struct rt721_sdca_priv *rt721 = snd_soc_component_get_drvdata(component);
unsigned int read_l, read_r, gain_l_val, gain_r_val;
unsigned int adc_vol_flag = 0, changed = 0;
unsigned int lvalue, rvalue;
const unsigned int interval_offset = 0xc0;
const unsigned int tendA = 0x200;
const unsigned int tendB = 0xa00;
if (strstr(ucontrol->id.name, "FU1E Capture Volume") ||
strstr(ucontrol->id.name, "FU0F Capture Volume"))
adc_vol_flag = 1;
regmap_read(rt721->mbq_regmap, mc->reg, &lvalue);
regmap_read(rt721->mbq_regmap, mc->rreg, &rvalue);
/* L Channel */
gain_l_val = ucontrol->value.integer.value[0];
if (gain_l_val > mc->max)
gain_l_val = mc->max;
if (mc->shift == 8) {
/* boost gain */
gain_l_val = gain_l_val * tendB;
} else if (mc->shift == 1) {
/* FU33 boost gain */
if (gain_l_val == 0)
gain_l_val = 0x8000;
else
gain_l_val = (gain_l_val - 1) * tendA;
} else {
/* ADC/DAC gain */
if (adc_vol_flag)
gain_l_val = 0x1e00 - ((mc->max - gain_l_val) * interval_offset);
else
gain_l_val = 0 - ((mc->max - gain_l_val) * interval_offset);
gain_l_val &= 0xffff;
}
/* R Channel */
gain_r_val = ucontrol->value.integer.value[1];
if (gain_r_val > mc->max)
gain_r_val = mc->max;
if (mc->shift == 8) {
/* boost gain */
gain_r_val = gain_r_val * tendB;
} else if (mc->shift == 1) {
/* FU33 boost gain */
if (gain_r_val == 0)
gain_r_val = 0x8000;
else
gain_r_val = (gain_r_val - 1) * tendA;
} else {
/* ADC/DAC gain */
if (adc_vol_flag)
gain_r_val = 0x1e00 - ((mc->max - gain_r_val) * interval_offset);
else
gain_r_val = 0 - ((mc->max - gain_r_val) * interval_offset);
gain_r_val &= 0xffff;
}
if (lvalue != gain_l_val || rvalue != gain_r_val)
changed = 1;
else
return 0;
/* Lch*/
Annotation
- Immediate include surface: `linux/bitops.h`, `sound/core.h`, `linux/delay.h`, `linux/init.h`, `sound/initval.h`, `sound/jack.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `function rt721_sdca_jack_detect_handler`, `function rt721_sdca_btn_check_handler`, `function rt721_sdca_dmic_preset`, `function rt721_sdca_amp_preset`, `function rt721_sdca_jack_preset`, `function rt721_sdca_jack_init`, `function rt721_sdca_set_jack_detect`, `function rt721_sdca_set_gain_put`, `function rt721_sdca_set_gain_get`, `function rt721_sdca_set_fu1e_capture_ctl`.
- 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.