sound/soc/codecs/rt5631.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt5631.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt5631.c- Extension
.c- Size
- 58327 bytes
- Lines
- 1739
- 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/moduleparam.hlinux/init.hlinux/delay.hlinux/pm.hlinux/i2c.hlinux/regmap.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-dapm.hsound/initval.hsound/tlv.hrt5631.h
Detected Declarations
struct rt5631_privstruct coeff_clk_divstruct pll_divfunction rt5631_write_indexfunction rt5631_read_indexfunction rt5631_resetfunction rt5631_volatile_registerfunction rt5631_readable_registerfunction rt5631_dmic_getfunction rt5631_dmic_putfunction check_sysclk1_sourcefunction check_dmic_usedfunction check_dacl_to_outmixlfunction check_dacr_to_outmixrfunction check_dacl_to_spkmixlfunction check_dacr_to_spkmixrfunction check_adcl_selectfunction check_adcr_selectfunction onebit_depop_power_stagefunction onebit_depop_mute_stagefunction depop_seq_power_stagefunction depop_seq_mute_stagefunction hp_eventfunction set_dmic_paramsfunction get_coefffunction rt5631_hifi_pcm_paramsfunction rt5631_hifi_codec_set_dai_fmtfunction rt5631_hifi_codec_set_dai_sysclkfunction rt5631_codec_set_dai_pllfunction rt5631_set_bias_levelfunction rt5631_probefunction rt5631_i2c_probe
Annotated Snippet
struct rt5631_priv {
struct regmap *regmap;
int codec_version;
int master;
int sysclk;
int rx_rate;
int bclk_rate;
int dmic_used_flag;
};
static const struct reg_default rt5631_reg[] = {
{ RT5631_SPK_OUT_VOL, 0x8888 },
{ RT5631_HP_OUT_VOL, 0x8080 },
{ RT5631_MONO_AXO_1_2_VOL, 0xa080 },
{ RT5631_AUX_IN_VOL, 0x0808 },
{ RT5631_ADC_REC_MIXER, 0xf0f0 },
{ RT5631_VDAC_DIG_VOL, 0x0010 },
{ RT5631_OUTMIXER_L_CTRL, 0xffc0 },
{ RT5631_OUTMIXER_R_CTRL, 0xffc0 },
{ RT5631_AXO1MIXER_CTRL, 0x88c0 },
{ RT5631_AXO2MIXER_CTRL, 0x88c0 },
{ RT5631_DIG_MIC_CTRL, 0x3000 },
{ RT5631_MONO_INPUT_VOL, 0x8808 },
{ RT5631_SPK_MIXER_CTRL, 0xf8f8 },
{ RT5631_SPK_MONO_OUT_CTRL, 0xfc00 },
{ RT5631_SPK_MONO_HP_OUT_CTRL, 0x4440 },
{ RT5631_SDP_CTRL, 0x8000 },
{ RT5631_MONO_SDP_CTRL, 0x8000 },
{ RT5631_STEREO_AD_DA_CLK_CTRL, 0x2010 },
{ RT5631_GEN_PUR_CTRL_REG, 0x0e00 },
{ RT5631_INT_ST_IRQ_CTRL_2, 0x071a },
{ RT5631_MISC_CTRL, 0x2040 },
{ RT5631_DEPOP_FUN_CTRL_2, 0x8000 },
{ RT5631_SOFT_VOL_CTRL, 0x07e0 },
{ RT5631_ALC_CTRL_1, 0x0206 },
{ RT5631_ALC_CTRL_3, 0x2000 },
{ RT5631_PSEUDO_SPATL_CTRL, 0x0553 },
};
/*
* rt5631_write_index - write index register of 2nd layer
*/
static void rt5631_write_index(struct snd_soc_component *component,
unsigned int reg, unsigned int value)
{
snd_soc_component_write(component, RT5631_INDEX_ADD, reg);
snd_soc_component_write(component, RT5631_INDEX_DATA, value);
}
/*
* rt5631_read_index - read index register of 2nd layer
*/
static unsigned int rt5631_read_index(struct snd_soc_component *component,
unsigned int reg)
{
unsigned int value;
snd_soc_component_write(component, RT5631_INDEX_ADD, reg);
value = snd_soc_component_read(component, RT5631_INDEX_DATA);
return value;
}
static int rt5631_reset(struct snd_soc_component *component)
{
return snd_soc_component_write(component, RT5631_RESET, 0);
}
static bool rt5631_volatile_register(struct device *dev, unsigned int reg)
{
switch (reg) {
case RT5631_RESET:
case RT5631_INT_ST_IRQ_CTRL_2:
case RT5631_INDEX_ADD:
case RT5631_INDEX_DATA:
case RT5631_EQ_CTRL:
return true;
default:
return false;
}
}
static bool rt5631_readable_register(struct device *dev, unsigned int reg)
{
switch (reg) {
case RT5631_RESET:
case RT5631_SPK_OUT_VOL:
case RT5631_HP_OUT_VOL:
case RT5631_MONO_AXO_1_2_VOL:
case RT5631_AUX_IN_VOL:
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/i2c.h`, `linux/regmap.h`, `sound/core.h`.
- Detected declarations: `struct rt5631_priv`, `struct coeff_clk_div`, `struct pll_div`, `function rt5631_write_index`, `function rt5631_read_index`, `function rt5631_reset`, `function rt5631_volatile_register`, `function rt5631_readable_register`, `function rt5631_dmic_get`, `function rt5631_dmic_put`.
- 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.