sound/soc/codecs/alc5623.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/alc5623.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/alc5623.c- Extension
.c- Size
- 34332 bytes
- Lines
- 1090
- 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/pm.hlinux/i2c.hlinux/regmap.hlinux/slab.hlinux/of.hsound/core.hsound/pcm.hsound/pcm_params.hsound/tlv.hsound/soc.hsound/initval.hsound/alc5623.halc5623.h
Detected Declarations
struct alc5623_privstruct _pll_divstruct _coeff_divfunction alc5623_resetfunction amp_mixer_eventfunction alc5623_set_dai_pllfunction get_coefffunction alc5623_set_dai_sysclkfunction alc5623_set_dai_fmtfunction alc5623_pcm_hw_paramsfunction alc5623_mutefunction enable_power_depopfunction alc5623_set_bias_levelfunction alc5623_suspendfunction alc5623_resumefunction alc5623_probefunction alc5623_i2c_probe
Annotated Snippet
struct alc5623_priv {
struct regmap *regmap;
u8 id;
unsigned int sysclk;
unsigned int add_ctrl;
unsigned int jack_det_ctrl;
};
static inline int alc5623_reset(struct snd_soc_component *component)
{
return snd_soc_component_write(component, ALC5623_RESET, 0);
}
static int amp_mixer_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
/* to power-on/off class-d amp generators/speaker */
/* need to write to 'index-46h' register : */
/* so write index num (here 0x46) to reg 0x6a */
/* and then 0xffff/0 to reg 0x6c */
snd_soc_component_write(component, ALC5623_HID_CTRL_INDEX, 0x46);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
snd_soc_component_write(component, ALC5623_HID_CTRL_DATA, 0xFFFF);
break;
case SND_SOC_DAPM_POST_PMD:
snd_soc_component_write(component, ALC5623_HID_CTRL_DATA, 0);
break;
}
return 0;
}
/*
* ALC5623 Controls
*/
static const DECLARE_TLV_DB_SCALE(vol_tlv, -3450, 150, 0);
static const DECLARE_TLV_DB_SCALE(hp_tlv, -4650, 150, 0);
static const DECLARE_TLV_DB_SCALE(adc_rec_tlv, -1650, 150, 0);
static const DECLARE_TLV_DB_RANGE(boost_tlv,
0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0)
);
static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0);
static const struct snd_kcontrol_new alc5621_vol_snd_controls[] = {
SOC_DOUBLE_TLV("Speaker Playback Volume",
ALC5623_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv),
SOC_DOUBLE("Speaker Playback Switch",
ALC5623_SPK_OUT_VOL, 15, 7, 1, 1),
SOC_DOUBLE_TLV("Headphone Playback Volume",
ALC5623_HP_OUT_VOL, 8, 0, 31, 1, hp_tlv),
SOC_DOUBLE("Headphone Playback Switch",
ALC5623_HP_OUT_VOL, 15, 7, 1, 1),
};
static const struct snd_kcontrol_new alc5622_vol_snd_controls[] = {
SOC_DOUBLE_TLV("Speaker Playback Volume",
ALC5623_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv),
SOC_DOUBLE("Speaker Playback Switch",
ALC5623_SPK_OUT_VOL, 15, 7, 1, 1),
SOC_DOUBLE_TLV("Line Playback Volume",
ALC5623_HP_OUT_VOL, 8, 0, 31, 1, hp_tlv),
SOC_DOUBLE("Line Playback Switch",
ALC5623_HP_OUT_VOL, 15, 7, 1, 1),
};
static const struct snd_kcontrol_new alc5623_vol_snd_controls[] = {
SOC_DOUBLE_TLV("Line Playback Volume",
ALC5623_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv),
SOC_DOUBLE("Line Playback Switch",
ALC5623_SPK_OUT_VOL, 15, 7, 1, 1),
SOC_DOUBLE_TLV("Headphone Playback Volume",
ALC5623_HP_OUT_VOL, 8, 0, 31, 1, hp_tlv),
SOC_DOUBLE("Headphone Playback Switch",
ALC5623_HP_OUT_VOL, 15, 7, 1, 1),
};
static const struct snd_kcontrol_new alc5623_snd_controls[] = {
SOC_DOUBLE_TLV("Auxout Playback Volume",
ALC5623_MONO_AUX_OUT_VOL, 8, 0, 31, 1, hp_tlv),
SOC_DOUBLE("Auxout Playback Switch",
ALC5623_MONO_AUX_OUT_VOL, 15, 7, 1, 1),
SOC_DOUBLE_TLV("PCM Playback Volume",
ALC5623_STEREO_DAC_VOL, 8, 0, 31, 1, vol_tlv),
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/i2c.h`, `linux/regmap.h`, `linux/slab.h`.
- Detected declarations: `struct alc5623_priv`, `struct _pll_div`, `struct _coeff_div`, `function alc5623_reset`, `function amp_mixer_event`, `function alc5623_set_dai_pll`, `function get_coeff`, `function alc5623_set_dai_sysclk`, `function alc5623_set_dai_fmt`, `function alc5623_pcm_hw_params`.
- 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.