#include <asm/dma.h>
#include <linux/init.h>
#include <linux/pnp.h>
#include <linux/err.h>
#include <linux/isa.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/sb.h>
#include <sound/sb16_csp.h>
#include <sound/mpu401.h>
#include <sound/opl3.h>
#include <sound/emu8000.h>
#include <sound/seq_device.h>
#define SNDRV_LEGACY_FIND_FREE_IRQ
#define SNDRV_LEGACY_FIND_FREE_DMA
#include <sound/initval.h>
#ifdef SNDRV_SBAWE
#define PFX …
#else
#define PFX …
#endif
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
#ifndef SNDRV_SBAWE
MODULE_DESCRIPTION(…) …;
#else
MODULE_DESCRIPTION("Sound Blaster AWE");
#endif
#if 0
#define SNDRV_DEBUG_IRQ
#endif
#if defined(SNDRV_SBAWE) && IS_ENABLED(CONFIG_SND_SEQUENCER)
#define SNDRV_SBAWE_EMU8000
#endif
static int index[SNDRV_CARDS] = …;
static char *id[SNDRV_CARDS] = …;
static bool enable[SNDRV_CARDS] = …;
#ifdef CONFIG_PNP
static bool isapnp[SNDRV_CARDS] = …;
#endif
static long port[SNDRV_CARDS] = …;
static long mpu_port[SNDRV_CARDS] = …;
static long fm_port[SNDRV_CARDS] = …;
#ifdef SNDRV_SBAWE_EMU8000
static long awe_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
#endif
static int irq[SNDRV_CARDS] = …;
static int dma8[SNDRV_CARDS] = …;
static int dma16[SNDRV_CARDS] = …;
static int mic_agc[SNDRV_CARDS] = …;
#ifdef CONFIG_SND_SB16_CSP
static int csp[SNDRV_CARDS];
#endif
#ifdef SNDRV_SBAWE_EMU8000
static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4};
#endif
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
#ifdef CONFIG_PNP
module_param_array(…);
MODULE_PARM_DESC(…) …;
#endif
module_param_hw_array(port, long, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(mpu_port, long, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(fm_port, long, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
#ifdef SNDRV_SBAWE_EMU8000
module_param_hw_array(awe_port, long, ioport, NULL, 0444);
MODULE_PARM_DESC(awe_port, "AWE port # for SB16 PnP driver.");
#endif
module_param_hw_array(irq, int, irq, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(dma8, int, dma, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(dma16, int, dma, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
#ifdef CONFIG_SND_SB16_CSP
module_param_array(…);
MODULE_PARM_DESC(…) …;
#endif
#ifdef SNDRV_SBAWE_EMU8000
module_param_array(seq_ports, int, NULL, 0444);
MODULE_PARM_DESC(seq_ports, "Number of sequencer ports for WaveTable synth.");
#endif
#ifdef CONFIG_PNP
static int isa_registered;
static int pnp_registered;
#endif
struct snd_card_sb16 { … };
#ifdef CONFIG_PNP
static const struct pnp_card_device_id snd_sb16_pnpids[] = …;
MODULE_DEVICE_TABLE(pnp_card, snd_sb16_pnpids);
#endif
#ifdef SNDRV_SBAWE_EMU8000
#define DRIVER_NAME …
#else
#define DRIVER_NAME …
#endif
#ifdef CONFIG_PNP
static int snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
struct pnp_card_link *card,
const struct pnp_card_device_id *id)
{ … }
#endif
#ifdef CONFIG_PNP
#define is_isapnp_selected(dev) …
#else
#define is_isapnp_selected …
#endif
static int snd_sb16_card_new(struct device *devptr, int dev,
struct snd_card **cardp)
{ … }
static int snd_sb16_probe(struct snd_card *card, int dev)
{ … }
#ifdef CONFIG_PM
static int snd_sb16_suspend(struct snd_card *card, pm_message_t state)
{ … }
static int snd_sb16_resume(struct snd_card *card)
{ … }
#endif
static int snd_sb16_isa_probe1(int dev, struct device *pdev)
{ … }
static int snd_sb16_isa_match(struct device *pdev, unsigned int dev)
{ … }
static int snd_sb16_isa_probe(struct device *pdev, unsigned int dev)
{ … }
#ifdef CONFIG_PM
static int snd_sb16_isa_suspend(struct device *dev, unsigned int n,
pm_message_t state)
{ … }
static int snd_sb16_isa_resume(struct device *dev, unsigned int n)
{ … }
#endif
#ifdef SNDRV_SBAWE
#define DEV_NAME …
#else
#define DEV_NAME …
#endif
static struct isa_driver snd_sb16_isa_driver = …;
#ifdef CONFIG_PNP
static int snd_sb16_pnp_detect(struct pnp_card_link *pcard,
const struct pnp_card_device_id *pid)
{ … }
#ifdef CONFIG_PM
static int snd_sb16_pnp_suspend(struct pnp_card_link *pcard, pm_message_t state)
{ … }
static int snd_sb16_pnp_resume(struct pnp_card_link *pcard)
{ … }
#endif
static struct pnp_card_driver sb16_pnpc_driver = …;
#endif
static int __init alsa_card_sb16_init(void)
{ … }
static void __exit alsa_card_sb16_exit(void)
{ … }
module_init(…) …
module_exit(…)