sound/isa/gus/gusclassic.c
Source file repositories/reference/linux-study-clean/sound/isa/gus/gusclassic.c
File Facts
- System
- Linux kernel
- Corpus path
sound/isa/gus/gusclassic.c- Extension
.c- Size
- 6581 bytes
- Lines
- 227
- Domain
- Driver Families
- Bucket
- sound/isa
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/err.hlinux/isa.hlinux/delay.hlinux/time.hlinux/module.hasm/dma.hsound/core.hsound/gus.hsound/initval.h
Detected Declarations
function snd_gusclassic_matchfunction snd_gusclassic_createfunction snd_gusclassic_detectfunction snd_gusclassic_probefunction snd_gusclassic_suspendfunction snd_gusclassic_resume
Annotated Snippet
if (irq[n] < 0) {
dev_err(dev, "unable to find a free IRQ\n");
return -EBUSY;
}
}
if (dma1[n] == SNDRV_AUTO_DMA) {
dma1[n] = snd_legacy_find_free_dma(possible_dmas);
if (dma1[n] < 0) {
dev_err(dev, "unable to find a free DMA1\n");
return -EBUSY;
}
}
if (dma2[n] == SNDRV_AUTO_DMA) {
dma2[n] = snd_legacy_find_free_dma(possible_dmas);
if (dma2[n] < 0) {
dev_err(dev, "unable to find a free DMA2\n");
return -EBUSY;
}
}
if (port[n] != SNDRV_AUTO_PORT)
return snd_gus_create(card, port[n], irq[n], dma1[n], dma2[n],
0, channels[n], pcm_channels[n], 0, rgus);
i = 0;
do {
port[n] = possible_ports[i];
error = snd_gus_create(card, port[n], irq[n], dma1[n], dma2[n],
0, channels[n], pcm_channels[n], 0, rgus);
} while (error < 0 && ++i < ARRAY_SIZE(possible_ports));
return error;
}
static int snd_gusclassic_detect(struct snd_gus_card *gus)
{
unsigned char d;
snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET);
if ((d & 0x07) != 0) {
dev_dbg(gus->card->dev, "[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
return -ENODEV;
}
udelay(160);
snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
udelay(160);
d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET);
if ((d & 0x07) != 1) {
dev_dbg(gus->card->dev, "[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
return -ENODEV;
}
return 0;
}
static int snd_gusclassic_probe(struct device *dev, unsigned int n)
{
struct snd_card *card;
struct snd_gus_card *gus;
int error;
error = snd_devm_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card);
if (error < 0)
return error;
if (pcm_channels[n] < 2)
pcm_channels[n] = 2;
error = snd_gusclassic_create(card, dev, n, &gus);
if (error < 0)
return error;
card->private_data = gus;
error = snd_gusclassic_detect(gus);
if (error < 0)
return error;
gus->joystick_dac = joystick_dac[n];
error = snd_gus_initialize(gus);
if (error < 0)
return error;
error = -ENODEV;
if (gus->max_flag || gus->ess_flag) {
dev_err(dev, "GUS Classic or ACE soundcard was "
"not detected at 0x%lx\n", gus->gf1.port);
return error;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/err.h`, `linux/isa.h`, `linux/delay.h`, `linux/time.h`, `linux/module.h`, `asm/dma.h`, `sound/core.h`.
- Detected declarations: `function snd_gusclassic_match`, `function snd_gusclassic_create`, `function snd_gusclassic_detect`, `function snd_gusclassic_probe`, `function snd_gusclassic_suspend`, `function snd_gusclassic_resume`.
- Atlas domain: Driver Families / sound/isa.
- 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.