sound/isa/sb/sb8.c
Source file repositories/reference/linux-study-clean/sound/isa/sb/sb8.c
File Facts
- System
- Linux kernel
- Corpus path
sound/isa/sb/sb8.c- Extension
.c- Size
- 5812 bytes
- Lines
- 222
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/err.hlinux/isa.hlinux/ioport.hlinux/module.hlinux/string.hsound/core.hsound/sb.hsound/opl3.hsound/initval.h
Detected Declarations
struct snd_sb8function snd_sb8_interruptfunction snd_sb8_matchfunction snd_sb8_probefunction snd_sb8_suspendfunction snd_sb8_resume
Annotated Snippet
struct snd_sb8 {
struct resource *fm_res; /* used to block FM i/o region for legacy cards */
struct snd_sb *chip;
};
static irqreturn_t snd_sb8_interrupt(int irq, void *dev_id)
{
struct snd_sb *chip = dev_id;
if (chip->open & SB_OPEN_PCM) {
return snd_sb8dsp_interrupt(chip);
} else {
return snd_sb8dsp_midi_interrupt(chip);
}
}
static int snd_sb8_match(struct device *pdev, unsigned int dev)
{
if (!enable[dev])
return 0;
if (irq[dev] == SNDRV_AUTO_IRQ) {
dev_err(pdev, "please specify irq\n");
return 0;
}
if (dma8[dev] == SNDRV_AUTO_DMA) {
dev_err(pdev, "please specify dma8\n");
return 0;
}
return 1;
}
static int snd_sb8_probe(struct device *pdev, unsigned int dev)
{
struct snd_sb *chip;
struct snd_card *card;
struct snd_sb8 *acard;
struct snd_opl3 *opl3;
int err;
err = snd_devm_card_new(pdev, index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_sb8), &card);
if (err < 0)
return err;
acard = card->private_data;
/*
* Block the 0x388 port to avoid PnP conflicts.
* No need to check this value after request_region,
* as we never do anything with it.
*/
acard->fm_res = devm_request_region(card->dev, 0x388, 4,
"SoundBlaster FM");
if (port[dev] != SNDRV_AUTO_PORT) {
err = snd_sbdsp_create(card, port[dev], irq[dev],
snd_sb8_interrupt, dma8[dev],
-1, SB_HW_AUTO, &chip);
if (err < 0)
return err;
} else {
/* auto-probe legacy ports */
static const unsigned long possible_ports[] = {
0x220, 0x240, 0x260,
};
int i;
for (i = 0; i < ARRAY_SIZE(possible_ports); i++) {
err = snd_sbdsp_create(card, possible_ports[i],
irq[dev],
snd_sb8_interrupt,
dma8[dev],
-1,
SB_HW_AUTO,
&chip);
if (err >= 0) {
port[dev] = possible_ports[i];
break;
}
}
if (i >= ARRAY_SIZE(possible_ports))
return -EINVAL;
}
acard->chip = chip;
if (chip->hardware >= SB_HW_16) {
if (chip->hardware == SB_HW_ALS100)
dev_warn(pdev, "ALS100 chip detected at 0x%lx, try snd-als100 module\n",
port[dev]);
else
dev_warn(pdev, "SB 16 chip detected at 0x%lx, try snd-sb16 module\n",
port[dev]);
Annotation
- Immediate include surface: `linux/init.h`, `linux/err.h`, `linux/isa.h`, `linux/ioport.h`, `linux/module.h`, `linux/string.h`, `sound/core.h`, `sound/sb.h`.
- Detected declarations: `struct snd_sb8`, `function snd_sb8_interrupt`, `function snd_sb8_match`, `function snd_sb8_probe`, `function snd_sb8_suspend`, `function snd_sb8_resume`.
- Atlas domain: Driver Families / sound/isa.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.