sound/soc/codecs/alc5632.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/alc5632.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/alc5632.c- Extension
.c- Size
- 39228 bytes
- Lines
- 1194
- 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/slab.hlinux/regmap.hsound/core.hsound/pcm.hsound/pcm_params.hsound/tlv.hsound/soc.hsound/initval.halc5632.h
Detected Declarations
struct alc5632_privstruct _pll_divstruct _coeff_divfunction alc5632_volatile_registerfunction alc5632_resetfunction amp_mixer_eventfunction alc5632_set_dai_pllfunction get_coefffunction alc5632_set_dai_sysclkfunction alc5632_set_dai_fmtfunction alc5632_pcm_hw_paramsfunction alc5632_mutefunction enable_power_depopfunction alc5632_set_bias_levelfunction alc5632_resumefunction alc5632_probefunction alc5632_i2c_probe
Annotated Snippet
struct alc5632_priv {
struct regmap *regmap;
u8 id;
unsigned int sysclk;
};
static bool alc5632_volatile_register(struct device *dev,
unsigned int reg)
{
switch (reg) {
case ALC5632_RESET:
case ALC5632_PWR_DOWN_CTRL_STATUS:
case ALC5632_GPIO_PIN_STATUS:
case ALC5632_OVER_CURR_STATUS:
case ALC5632_HID_CTRL_DATA:
case ALC5632_EQ_CTRL:
case ALC5632_VENDOR_ID1:
case ALC5632_VENDOR_ID2:
return true;
default:
break;
}
return false;
}
static inline int alc5632_reset(struct regmap *map)
{
return regmap_write(map, ALC5632_RESET, 0x59B4);
}
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, ALC5632_HID_CTRL_INDEX, 0x46);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
snd_soc_component_write(component, ALC5632_HID_CTRL_DATA, 0xFFFF);
break;
case SND_SOC_DAPM_POST_PMD:
snd_soc_component_write(component, ALC5632_HID_CTRL_DATA, 0);
break;
}
return 0;
}
/*
* ALC5632 Controls
*/
/* -34.5db min scale, 1.5db steps, no mute */
static const DECLARE_TLV_DB_SCALE(vol_tlv, -3450, 150, 0);
/* -46.5db min scale, 1.5db steps, no mute */
static const DECLARE_TLV_DB_SCALE(hp_tlv, -4650, 150, 0);
/* -16.5db min scale, 1.5db steps, no mute */
static const DECLARE_TLV_DB_SCALE(adc_rec_tlv, -1650, 150, 0);
static const DECLARE_TLV_DB_RANGE(boost_tlv,
0, 1, TLV_DB_SCALE_ITEM(0, 2000, 0),
1, 3, TLV_DB_SCALE_ITEM(2000, 1000, 0)
);
/* 0db min scale, 6 db steps, no mute */
static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0);
/* 0db min scalem 0.75db steps, no mute */
static const DECLARE_TLV_DB_SCALE(vdac_tlv, -3525, 75, 0);
static const struct snd_kcontrol_new alc5632_vol_snd_controls[] = {
/* left starts at bit 8, right at bit 0 */
/* 31 steps (5 bit), -46.5db scale */
SOC_DOUBLE_TLV("Speaker Playback Volume",
ALC5632_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv),
/* bit 15 mutes left, bit 7 right */
SOC_DOUBLE("Speaker Playback Switch",
ALC5632_SPK_OUT_VOL, 15, 7, 1, 1),
SOC_DOUBLE_TLV("Headphone Playback Volume",
ALC5632_HP_OUT_VOL, 8, 0, 31, 1, hp_tlv),
SOC_DOUBLE("Headphone Playback Switch",
ALC5632_HP_OUT_VOL, 15, 7, 1, 1),
};
static const struct snd_kcontrol_new alc5632_snd_controls[] = {
SOC_DOUBLE_TLV("Auxout Playback Volume",
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/i2c.h`, `linux/slab.h`, `linux/regmap.h`.
- Detected declarations: `struct alc5632_priv`, `struct _pll_div`, `struct _coeff_div`, `function alc5632_volatile_register`, `function alc5632_reset`, `function amp_mixer_event`, `function alc5632_set_dai_pll`, `function get_coeff`, `function alc5632_set_dai_sysclk`, `function alc5632_set_dai_fmt`.
- 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.