sound/soc/codecs/rt715.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt715.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt715.c- Extension
.c- Size
- 33093 bytes
- Lines
- 1134
- 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/module.hlinux/kernel.hlinux/init.hlinux/delay.hlinux/i2c.hlinux/pm_runtime.hlinux/pm.hlinux/soundwire/sdw.hlinux/regmap.hlinux/slab.hlinux/platform_device.hlinux/regulator/consumer.hsound/core.hsound/pcm.hsound/pcm_params.hsound/sdw.hsound/soc.hsound/soc-dapm.hsound/initval.hsound/tlv.hsound/hda_verbs.hrt715.h
Detected Declarations
function Copyrightfunction rt715_index_write_nidfunction rt715_index_read_nidfunction rt715_index_update_bitsfunction rt715_resetfunction rt715_get_gainfunction rt715_set_amp_gain_putfunction rt715_set_amp_gain_getfunction rt715_set_main_switch_putfunction rt715_set_main_switch_getfunction rt715_set_main_vol_putfunction rt715_set_main_vol_getfunction rt715_switch_infofunction rt715_vol_infofunction rt715_mux_getfunction rt715_mux_putfunction rt715_set_bias_levelfunction rt715_probefunction rt715_set_sdw_streamfunction rt715_shutdownfunction rt715_pcm_hw_paramsfunction rt715_pcm_hw_freefunction rt715_clock_configfunction rt715_initfunction rt715_io_init
Annotated Snippet
if (ucontrol->value.integer.value[i] != rt715->kctl_2ch_vol_ori[i]) {
k_vol_changed = 1;
break;
}
}
/* Can't use update bit function, so read the original value first */
addr_h = mc->reg;
addr_l = mc->rreg;
if (mc->shift == RT715_DIR_OUT_SFT) /* output */
val_h = 0x80;
else /* input */
val_h = 0x0;
rt715_get_gain(rt715, addr_h, addr_l, val_h, &read_rl, &read_ll);
if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY)
regmap_write(rt715->regmap,
RT715_SET_AUDIO_POWER_STATE, AC_PWRST_D0);
/* L Channel */
rt715->kctl_2ch_vol_ori[0] = ucontrol->value.integer.value[0];
/* for gain */
val_ll = ((ucontrol->value.integer.value[0]) & 0x7f);
if (val_ll > mc->max)
val_ll = mc->max;
/* keep mute status */
val_ll |= read_ll & 0x80;
/* R Channel */
rt715->kctl_2ch_vol_ori[1] = ucontrol->value.integer.value[1];
/* for gain */
val_lr = ((ucontrol->value.integer.value[1]) & 0x7f);
if (val_lr > mc->max)
val_lr = mc->max;
/* keep mute status */
val_lr |= read_rl & 0x80;
for (i = 0; i < 3; i++) { /* retry 3 times at most */
if (val_ll == val_lr) {
/* Set both L/R channels at the same time */
val_h = (1 << mc->shift) | (3 << 4);
regmap_write(rt715->regmap, addr_h,
(val_h << 8) | val_ll);
regmap_write(rt715->regmap, addr_l,
(val_h << 8) | val_ll);
} else {
/* Lch*/
val_h = (1 << mc->shift) | (1 << 5);
regmap_write(rt715->regmap, addr_h,
(val_h << 8) | val_ll);
/* Rch */
val_h = (1 << mc->shift) | (1 << 4);
regmap_write(rt715->regmap, addr_l,
(val_h << 8) | val_lr);
}
/* check result */
if (mc->shift == RT715_DIR_OUT_SFT) /* output */
val_h = 0x80;
else /* input */
val_h = 0x0;
rt715_get_gain(rt715, addr_h, addr_l, val_h,
&read_rl, &read_ll);
if (read_rl == val_lr && read_ll == val_ll)
break;
}
/* D0:power on state, D3: power saving mode */
if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY)
regmap_write(rt715->regmap,
RT715_SET_AUDIO_POWER_STATE, AC_PWRST_D3);
return k_vol_changed;
}
static int rt715_set_amp_gain_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct rt715_priv *rt715 = snd_soc_component_get_drvdata(component);
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
unsigned int addr_h, addr_l, val_h;
unsigned int read_ll, read_rl;
addr_h = mc->reg;
addr_l = mc->rreg;
if (mc->shift == RT715_DIR_OUT_SFT) /* output */
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/delay.h`, `linux/i2c.h`, `linux/pm_runtime.h`, `linux/pm.h`, `linux/soundwire/sdw.h`.
- Detected declarations: `function Copyright`, `function rt715_index_write_nid`, `function rt715_index_read_nid`, `function rt715_index_update_bits`, `function rt715_reset`, `function rt715_get_gain`, `function rt715_set_amp_gain_put`, `function rt715_set_amp_gain_get`, `function rt715_set_main_switch_put`, `function rt715_set_main_switch_get`.
- 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.