sound/soc/codecs/ak5558.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/ak5558.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/ak5558.c- Extension
.c- Size
- 13326 bytes
- Lines
- 516
- 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/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/of.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hsound/initval.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-dapm.hsound/tlv.hak5558.h
Detected Declarations
struct ak5558_privenum ak555x_typefunction ak5558_set_mckifunction ak5558_hw_paramsfunction ak5558_set_dai_fmtfunction ak5558_set_tdm_slotfunction ak5558_startupfunction ak5558_resetfunction ak5558_probefunction ak5558_removefunction ak5558_runtime_suspendfunction ak5558_runtime_resumefunction ak5558_i2c_probefunction ak5558_i2c_remove
Annotated Snippet
struct ak5558_priv {
struct regulator_bulk_data supplies[AK5558_NUM_SUPPLIES];
struct regmap *regmap;
struct i2c_client *i2c;
struct gpio_desc *reset_gpiod; /* Reset & Power down GPIO */
int slots;
int slot_width;
};
/* ak5558 register cache & default register settings */
static const struct reg_default ak5558_reg[] = {
{ 0x0, 0xFF }, /* 0x00 AK5558_00_POWER_MANAGEMENT1 */
{ 0x1, 0x01 }, /* 0x01 AK5558_01_POWER_MANAGEMENT2 */
{ 0x2, 0x01 }, /* 0x02 AK5558_02_CONTROL1 */
{ 0x3, 0x00 }, /* 0x03 AK5558_03_CONTROL2 */
{ 0x4, 0x00 }, /* 0x04 AK5558_04_CONTROL3 */
{ 0x5, 0x00 } /* 0x05 AK5558_05_DSD */
};
static const char * const mono_texts[] = {
"8 Slot", "2 Slot", "4 Slot", "1 Slot",
};
static const struct soc_enum ak5558_mono_enum[] = {
SOC_ENUM_SINGLE(AK5558_01_POWER_MANAGEMENT2, 1,
ARRAY_SIZE(mono_texts), mono_texts),
};
static const char * const mono_5552_texts[] = {
"2 Slot", "1 Slot (Fixed)", "2 Slot", "1 Slot (Optimal)",
};
static const struct soc_enum ak5552_mono_enum[] = {
SOC_ENUM_SINGLE(AK5558_01_POWER_MANAGEMENT2, 1,
ARRAY_SIZE(mono_5552_texts), mono_5552_texts),
};
static const char * const digfil_texts[] = {
"Sharp Roll-Off", "Slow Roll-Off",
"Short Delay Sharp Roll-Off", "Short Delay Slow Roll-Off",
};
static const struct soc_enum ak5558_adcset_enum[] = {
SOC_ENUM_SINGLE(AK5558_04_CONTROL3, 0,
ARRAY_SIZE(digfil_texts), digfil_texts),
};
static const struct snd_kcontrol_new ak5558_snd_controls[] = {
SOC_ENUM("Monaural Mode", ak5558_mono_enum[0]),
SOC_ENUM("Digital Filter", ak5558_adcset_enum[0]),
};
static const struct snd_kcontrol_new ak5552_snd_controls[] = {
SOC_ENUM("Monaural Mode", ak5552_mono_enum[0]),
SOC_ENUM("Digital Filter", ak5558_adcset_enum[0]),
};
static const struct snd_soc_dapm_widget ak5558_dapm_widgets[] = {
/* Analog Input */
SND_SOC_DAPM_INPUT("AIN1"),
SND_SOC_DAPM_INPUT("AIN2"),
SND_SOC_DAPM_INPUT("AIN3"),
SND_SOC_DAPM_INPUT("AIN4"),
SND_SOC_DAPM_INPUT("AIN5"),
SND_SOC_DAPM_INPUT("AIN6"),
SND_SOC_DAPM_INPUT("AIN7"),
SND_SOC_DAPM_INPUT("AIN8"),
SND_SOC_DAPM_ADC("ADC Ch1", NULL, AK5558_00_POWER_MANAGEMENT1, 0, 0),
SND_SOC_DAPM_ADC("ADC Ch2", NULL, AK5558_00_POWER_MANAGEMENT1, 1, 0),
SND_SOC_DAPM_ADC("ADC Ch3", NULL, AK5558_00_POWER_MANAGEMENT1, 2, 0),
SND_SOC_DAPM_ADC("ADC Ch4", NULL, AK5558_00_POWER_MANAGEMENT1, 3, 0),
SND_SOC_DAPM_ADC("ADC Ch5", NULL, AK5558_00_POWER_MANAGEMENT1, 4, 0),
SND_SOC_DAPM_ADC("ADC Ch6", NULL, AK5558_00_POWER_MANAGEMENT1, 5, 0),
SND_SOC_DAPM_ADC("ADC Ch7", NULL, AK5558_00_POWER_MANAGEMENT1, 6, 0),
SND_SOC_DAPM_ADC("ADC Ch8", NULL, AK5558_00_POWER_MANAGEMENT1, 7, 0),
SND_SOC_DAPM_AIF_OUT("SDTO", "Capture", 0, SND_SOC_NOPM, 0, 0),
};
static const struct snd_soc_dapm_widget ak5552_dapm_widgets[] = {
/* Analog Input */
SND_SOC_DAPM_INPUT("AIN1"),
SND_SOC_DAPM_INPUT("AIN2"),
SND_SOC_DAPM_ADC("ADC Ch1", NULL, AK5558_00_POWER_MANAGEMENT1, 0, 0),
SND_SOC_DAPM_ADC("ADC Ch2", NULL, AK5558_00_POWER_MANAGEMENT1, 1, 0),
SND_SOC_DAPM_AIF_OUT("SDTO", "Capture", 0, SND_SOC_NOPM, 0, 0),
};
Annotation
- Immediate include surface: `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/of.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct ak5558_priv`, `enum ak555x_type`, `function ak5558_set_mcki`, `function ak5558_hw_params`, `function ak5558_set_dai_fmt`, `function ak5558_set_tdm_slot`, `function ak5558_startup`, `function ak5558_reset`, `function ak5558_probe`, `function ak5558_remove`.
- 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.