sound/pcmcia/pdaudiocf/pdaudiocf_core.c
Source file repositories/reference/linux-study-clean/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pcmcia/pdaudiocf/pdaudiocf_core.c- Extension
.c- Size
- 8475 bytes
- Lines
- 279
- Domain
- Driver Families
- Bucket
- sound/pcmcia
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/slab.hsound/core.hsound/info.hpdaudiocf.hsound/initval.h
Detected Declarations
function Copyrightfunction pdacf_ak4117_writefunction pdacf_dumpfunction pdacf_resetfunction pdacf_reinitfunction pdacf_proc_readfunction pdacf_proc_initfunction snd_pdacf_ak4117_changefunction snd_pdacf_ak4117_createfunction snd_pdacf_powerdownfunction snd_pdacf_suspendfunction check_signalfunction snd_pdacf_resume
Annotated Snippet
if (--timeout == 0) {
spin_unlock_irqrestore(&chip->ak4117_lock, flags);
dev_err(chip->card->dev, "AK4117 ready timeout (read)\n");
return 0;
}
}
pdacf_reg_write(chip, PDAUDIOCF_REG_AK_IFR, (u16)reg << 8);
timeout = 1000;
while (pdacf_reg_read(chip, PDAUDIOCF_REG_SCR) & PDAUDIOCF_AK_SBP) {
udelay(5);
if (--timeout == 0) {
spin_unlock_irqrestore(&chip->ak4117_lock, flags);
dev_err(chip->card->dev, "AK4117 read timeout (read2)\n");
return 0;
}
}
res = (unsigned char)pdacf_reg_read(chip, PDAUDIOCF_REG_AK_IFR);
spin_unlock_irqrestore(&chip->ak4117_lock, flags);
return res;
}
static void pdacf_ak4117_write(void *private_data, unsigned char reg, unsigned char val)
{
struct snd_pdacf *chip = private_data;
unsigned long timeout;
unsigned long flags;
spin_lock_irqsave(&chip->ak4117_lock, flags);
timeout = 1000;
while (inw(chip->port + PDAUDIOCF_REG_SCR) & PDAUDIOCF_AK_SBP) {
udelay(5);
if (--timeout == 0) {
spin_unlock_irqrestore(&chip->ak4117_lock, flags);
dev_err(chip->card->dev, "AK4117 ready timeout (write)\n");
return;
}
}
outw((u16)reg << 8 | val | (1<<13), chip->port + PDAUDIOCF_REG_AK_IFR);
spin_unlock_irqrestore(&chip->ak4117_lock, flags);
}
#if 0
void pdacf_dump(struct snd_pdacf *chip)
{
dev_dbg(chip->card->dev, "PDAUDIOCF DUMP (0x%lx):\n", chip->port);
dev_dbg(chip->card->dev, "WPD : 0x%x\n",
inw(chip->port + PDAUDIOCF_REG_WDP));
dev_dbg(chip->card->dev, "RDP : 0x%x\n",
inw(chip->port + PDAUDIOCF_REG_RDP));
dev_dbg(chip->card->dev, "TCR : 0x%x\n",
inw(chip->port + PDAUDIOCF_REG_TCR));
dev_dbg(chip->card->dev, "SCR : 0x%x\n",
inw(chip->port + PDAUDIOCF_REG_SCR));
dev_dbg(chip->card->dev, "ISR : 0x%x\n",
inw(chip->port + PDAUDIOCF_REG_ISR));
dev_dbg(chip->card->dev, "IER : 0x%x\n",
inw(chip->port + PDAUDIOCF_REG_IER));
dev_dbg(chip->card->dev, "AK_IFR : 0x%x\n",
inw(chip->port + PDAUDIOCF_REG_AK_IFR));
}
#endif
static int pdacf_reset(struct snd_pdacf *chip, int powerdown)
{
u16 val;
val = pdacf_reg_read(chip, PDAUDIOCF_REG_SCR);
val |= PDAUDIOCF_PDN;
val &= ~PDAUDIOCF_RECORD; /* for sure */
pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val);
udelay(5);
val |= PDAUDIOCF_RST;
pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val);
udelay(200);
val &= ~PDAUDIOCF_RST;
pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val);
udelay(5);
if (!powerdown) {
val &= ~PDAUDIOCF_PDN;
pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, val);
udelay(200);
}
return 0;
}
void pdacf_reinit(struct snd_pdacf *chip, int resume)
{
pdacf_reset(chip, 0);
if (resume)
pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, chip->suspend_reg_scr);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/slab.h`, `sound/core.h`, `sound/info.h`, `pdaudiocf.h`, `sound/initval.h`.
- Detected declarations: `function Copyright`, `function pdacf_ak4117_write`, `function pdacf_dump`, `function pdacf_reset`, `function pdacf_reinit`, `function pdacf_proc_read`, `function pdacf_proc_init`, `function snd_pdacf_ak4117_change`, `function snd_pdacf_ak4117_create`, `function snd_pdacf_powerdown`.
- Atlas domain: Driver Families / sound/pcmcia.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.