sound/pci/ak4531_codec.c
Source file repositories/reference/linux-study-clean/sound/pci/ak4531_codec.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/ak4531_codec.c- Extension
.c- Size
- 16472 bytes
- Lines
- 468
- Domain
- Driver Families
- Bucket
- sound/pci
- 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/init.hlinux/slab.hlinux/mutex.hlinux/module.hsound/core.hsound/ak4531_codec.hsound/tlv.h
Detected Declarations
function snd_ak4531_dumpfunction snd_ak4531_info_singlefunction snd_ak4531_get_singlefunction snd_ak4531_put_singlefunction snd_ak4531_info_doublefunction snd_ak4531_get_doublefunction snd_ak4531_put_doublefunction snd_ak4531_info_input_swfunction snd_ak4531_get_input_swfunction snd_ak4531_put_input_swfunction snd_ak4531_freefunction snd_ak4531_dev_freefunction snd_ak4531_mixerfunction snd_ak4531_suspendfunction snd_ak4531_resumefunction snd_ak4531_proc_readfunction snd_ak4531_proc_init
Annotated Snippet
if (err < 0) {
snd_ak4531_free(ak4531);
return err;
}
}
snd_ak4531_proc_init(card, ak4531);
err = snd_device_new(card, SNDRV_DEV_CODEC, ak4531, &ops);
if (err < 0) {
snd_ak4531_free(ak4531);
return err;
}
#if 0
snd_ak4531_dump(ak4531);
#endif
if (rak4531)
*rak4531 = ak4531;
return 0;
}
/*
* power management
*/
#ifdef CONFIG_PM
void snd_ak4531_suspend(struct snd_ak4531 *ak4531)
{
/* mute */
ak4531->write(ak4531, AK4531_LMASTER, 0x9f);
ak4531->write(ak4531, AK4531_RMASTER, 0x9f);
/* powerdown */
ak4531->write(ak4531, AK4531_RESET, 0x01);
}
void snd_ak4531_resume(struct snd_ak4531 *ak4531)
{
int idx;
/* initialize */
ak4531->write(ak4531, AK4531_RESET, 0x03);
udelay(100);
ak4531->write(ak4531, AK4531_CLOCK, 0x00);
/* restore mixer registers */
for (idx = 0; idx <= 0x19; idx++) {
if (idx == AK4531_RESET || idx == AK4531_CLOCK)
continue;
ak4531->write(ak4531, idx, ak4531->regs[idx]);
}
}
#endif
/*
* /proc interface
*/
static void snd_ak4531_proc_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
struct snd_ak4531 *ak4531 = entry->private_data;
snd_iprintf(buffer, "Asahi Kasei AK4531\n\n");
snd_iprintf(buffer, "Recording source : %s\n"
"MIC gain : %s\n",
ak4531->regs[AK4531_AD_IN] & 1 ? "external" : "mixer",
ak4531->regs[AK4531_MIC_GAIN] & 1 ? "+30dB" : "+0dB");
}
static void
snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531)
{
snd_card_ro_proc_new(card, "ak4531", ak4531, snd_ak4531_proc_read);
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/init.h`, `linux/slab.h`, `linux/mutex.h`, `linux/module.h`, `sound/core.h`, `sound/ak4531_codec.h`, `sound/tlv.h`.
- Detected declarations: `function snd_ak4531_dump`, `function snd_ak4531_info_single`, `function snd_ak4531_get_single`, `function snd_ak4531_put_single`, `function snd_ak4531_info_double`, `function snd_ak4531_get_double`, `function snd_ak4531_put_double`, `function snd_ak4531_info_input_sw`, `function snd_ak4531_get_input_sw`, `function snd_ak4531_put_input_sw`.
- Atlas domain: Driver Families / sound/pci.
- 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.