sound/ppc/awacs.c
Source file repositories/reference/linux-study-clean/sound/ppc/awacs.c
File Facts
- System
- Linux kernel
- Corpus path
sound/ppc/awacs.c- Extension
.c- Size
- 31633 bytes
- Lines
- 1124
- Domain
- Driver Families
- Bucket
- sound/ppc
- 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/io.hasm/nvram.hlinux/init.hlinux/delay.hlinux/of.hlinux/slab.hsound/core.hpmac.h
Detected Declarations
struct awacs_ampfunction snd_pmac_screamer_waitfunction snd_pmac_awacs_writefunction snd_pmac_awacs_write_regfunction snd_pmac_awacs_write_noregfunction screamer_recalibratefunction snd_pmac_awacs_set_formatfunction snd_pmac_awacs_info_volumefunction snd_pmac_awacs_get_volumefunction snd_pmac_awacs_put_volumefunction snd_pmac_awacs_get_switchfunction snd_pmac_awacs_put_switchfunction awacs_set_cudafunction awacs_amp_set_tonefunction awacs_amp_set_volfunction awacs_amp_set_masterfunction awacs_amp_freefunction snd_pmac_awacs_info_volume_ampfunction snd_pmac_awacs_get_volume_ampfunction snd_pmac_awacs_put_volume_ampfunction snd_pmac_awacs_get_switch_ampfunction snd_pmac_awacs_put_switch_ampfunction snd_pmac_awacs_info_tone_ampfunction snd_pmac_awacs_get_tone_ampfunction snd_pmac_awacs_put_tone_ampfunction snd_pmac_awacs_info_master_ampfunction snd_pmac_awacs_get_master_ampfunction snd_pmac_awacs_put_master_ampfunction snd_pmac_screamer_mic_boost_infofunction snd_pmac_screamer_mic_boost_getfunction snd_pmac_screamer_mic_boost_putfunction build_mixersfunction awacs_restore_all_regsfunction snd_pmac_awacs_suspendfunction snd_pmac_awacs_resumefunction snd_pmac_awacs_detect_headphonefunction toggle_amp_mutefunction snd_pmac_awacs_update_automutefunction snd_pmac_awacs_init
Annotated Snippet
struct awacs_amp {
unsigned char amp_master;
unsigned char amp_vol[2][2];
unsigned char amp_tone[2];
};
#define CHECK_CUDA_AMP() (sys_ctrler == SYS_CTRLER_CUDA)
#endif /* PMAC_AMP_AVAIL */
static void snd_pmac_screamer_wait(struct snd_pmac *chip)
{
long timeout = 2000;
while (!(in_le32(&chip->awacs->codec_stat) & MASK_VALID)) {
mdelay(1);
if (! --timeout) {
dev_dbg(chip->card->dev, "%s timeout\n", __func__);
break;
}
}
}
/*
* write AWACS register
*/
static void
snd_pmac_awacs_write(struct snd_pmac *chip, int val)
{
long timeout = 5000000;
if (chip->model == PMAC_SCREAMER)
snd_pmac_screamer_wait(chip);
out_le32(&chip->awacs->codec_ctrl, val | (chip->subframe << 22));
while (in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) {
if (! --timeout) {
dev_dbg(chip->card->dev, "%s timeout\n", __func__);
break;
}
}
}
static void
snd_pmac_awacs_write_reg(struct snd_pmac *chip, int reg, int val)
{
snd_pmac_awacs_write(chip, val | (reg << 12));
chip->awacs_reg[reg] = val;
}
static void
snd_pmac_awacs_write_noreg(struct snd_pmac *chip, int reg, int val)
{
snd_pmac_awacs_write(chip, val | (reg << 12));
}
#ifdef CONFIG_PM
/* Recalibrate chip */
static void screamer_recalibrate(struct snd_pmac *chip)
{
if (chip->model != PMAC_SCREAMER)
return;
/* Sorry for the horrible delays... I hope to get that improved
* by making the whole PM process asynchronous in a future version
*/
snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]);
if (chip->manufacturer == 0x1)
/* delay for broken crystal part */
msleep(750);
snd_pmac_awacs_write_noreg(chip, 1,
chip->awacs_reg[1] | MASK_RECALIBRATE |
MASK_CMUTE | MASK_AMUTE);
snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]);
snd_pmac_awacs_write_noreg(chip, 6, chip->awacs_reg[6]);
}
#else
#define screamer_recalibrate(chip) /* NOP */
#endif
/*
* additional callback to set the pcm format
*/
static void snd_pmac_awacs_set_format(struct snd_pmac *chip)
{
chip->awacs_reg[1] &= ~MASK_SAMPLERATE;
chip->awacs_reg[1] |= chip->rate_index << 3;
snd_pmac_awacs_write_reg(chip, 1, chip->awacs_reg[1]);
}
Annotation
- Immediate include surface: `linux/io.h`, `asm/nvram.h`, `linux/init.h`, `linux/delay.h`, `linux/of.h`, `linux/slab.h`, `sound/core.h`, `pmac.h`.
- Detected declarations: `struct awacs_amp`, `function snd_pmac_screamer_wait`, `function snd_pmac_awacs_write`, `function snd_pmac_awacs_write_reg`, `function snd_pmac_awacs_write_noreg`, `function screamer_recalibrate`, `function snd_pmac_awacs_set_format`, `function snd_pmac_awacs_info_volume`, `function snd_pmac_awacs_get_volume`, `function snd_pmac_awacs_put_volume`.
- Atlas domain: Driver Families / sound/ppc.
- 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.