#include <linux/init.h>
#include <linux/err.h>
#include <linux/isa.h>
#include <linux/pnp.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/wss.h>
#include <sound/opl3.h>
#include <sound/mpu401.h>
#include <sound/sb.h>
#include <sound/initval.h>
#define PLAYBACK_ON_SB
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
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 sbport[SNDRV_CARDS] = …;
static int sbirq[SNDRV_CARDS] = …;
static int sbdma8[SNDRV_CARDS] = …;
static int sbdma16[SNDRV_CARDS] = …;
static long wssport[SNDRV_CARDS] = …;
static int wssirq[SNDRV_CARDS] = …;
static int wssdma[SNDRV_CARDS] = …;
static long fmport[SNDRV_CARDS] = …;
static long mpuport[SNDRV_CARDS] = …;
static int mpuirq[SNDRV_CARDS] = …;
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(sbport, long, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(sbirq, int, irq, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(sbdma8, int, dma, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(sbdma16, int, dma, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(wssport, long, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(wssirq, int, irq, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(wssdma, int, dma, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(fmport, long, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(mpuport, long, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(mpuirq, int, irq, NULL, 0444);
MODULE_PARM_DESC(…) …;
#ifdef CONFIG_PNP
static int isa_registered;
static int pnp_registered;
#endif
#define CMI8330_RMUX3D …
#define CMI8330_MUTEMUX …
#define CMI8330_OUTPUTVOL …
#define CMI8330_MASTVOL …
#define CMI8330_LINVOL …
#define CMI8330_CDINVOL …
#define CMI8330_WAVVOL …
#define CMI8330_RECMUX …
#define CMI8330_WAVGAIN …
#define CMI8330_LINGAIN …
#define CMI8330_CDINGAIN …
static const unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] = …;
snd_pcm_open_callback_t;
enum card_type { … };
struct snd_cmi8330 { … };
#ifdef CONFIG_PNP
static const struct pnp_card_device_id snd_cmi8330_pnpids[] = …;
MODULE_DEVICE_TABLE(pnp_card, snd_cmi8330_pnpids);
#endif
static const struct snd_kcontrol_new snd_cmi8330_controls[] = …;
#ifdef ENABLE_SB_MIXER
static const struct sbmix_elem cmi8330_sb_mixers[] = {
SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31),
SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15),
SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15),
SB_DOUBLE("SB PCM Playback Volume", SB_DSP4_PCM_DEV, (SB_DSP4_PCM_DEV + 1), 3, 3, 31),
SB_DOUBLE("SB Synth Playback Volume", SB_DSP4_SYNTH_DEV, (SB_DSP4_SYNTH_DEV + 1), 3, 3, 31),
SB_DOUBLE("SB CD Playback Switch", SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 2, 1, 1),
SB_DOUBLE("SB CD Playback Volume", SB_DSP4_CD_DEV, (SB_DSP4_CD_DEV + 1), 3, 3, 31),
SB_DOUBLE("SB Line Playback Switch", SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 4, 3, 1),
SB_DOUBLE("SB Line Playback Volume", SB_DSP4_LINE_DEV, (SB_DSP4_LINE_DEV + 1), 3, 3, 31),
SB_SINGLE("SB Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1),
SB_SINGLE("SB Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31),
SB_SINGLE("SB Beep Volume", SB_DSP4_SPEAKER_DEV, 6, 3),
SB_DOUBLE("SB Capture Volume", SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3),
SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6, 3),
SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1),
};
static const unsigned char cmi8330_sb_init_values[][2] = {
{ SB_DSP4_MASTER_DEV + 0, 0 },
{ SB_DSP4_MASTER_DEV + 1, 0 },
{ SB_DSP4_PCM_DEV + 0, 0 },
{ SB_DSP4_PCM_DEV + 1, 0 },
{ SB_DSP4_SYNTH_DEV + 0, 0 },
{ SB_DSP4_SYNTH_DEV + 1, 0 },
{ SB_DSP4_INPUT_LEFT, 0 },
{ SB_DSP4_INPUT_RIGHT, 0 },
{ SB_DSP4_OUTPUT_SW, 0 },
{ SB_DSP4_SPEAKER_DEV, 0 },
};
static int cmi8330_add_sb_mixers(struct snd_sb *chip)
{
int idx, err;
unsigned long flags;
spin_lock_irqsave(&chip->mixer_lock, flags);
snd_sbmixer_write(chip, 0x00, 0x00);
spin_unlock_irqrestore(&chip->mixer_lock, flags);
for (idx = 0; idx < ARRAY_SIZE(cmi8330_sb_init_values); idx++) {
spin_lock_irqsave(&chip->mixer_lock, flags);
snd_sbmixer_write(chip, cmi8330_sb_init_values[idx][0],
cmi8330_sb_init_values[idx][1]);
spin_unlock_irqrestore(&chip->mixer_lock, flags);
}
for (idx = 0; idx < ARRAY_SIZE(cmi8330_sb_mixers); idx++) {
err = snd_sbmixer_add_ctl_elem(chip, &cmi8330_sb_mixers[idx]);
if (err < 0)
return err;
}
return 0;
}
#endif
static int snd_cmi8330_mixer(struct snd_card *card, struct snd_cmi8330 *acard)
{ … }
#ifdef CONFIG_PNP
static int snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
struct pnp_card_link *card,
const struct pnp_card_device_id *id)
{ … }
#endif
#ifdef PLAYBACK_ON_SB
#define CMI_SB_STREAM …
#define CMI_AD_STREAM …
#else
#define CMI_SB_STREAM …
#define CMI_AD_STREAM …
#endif
static int snd_cmi8330_playback_open(struct snd_pcm_substream *substream)
{ … }
static int snd_cmi8330_capture_open(struct snd_pcm_substream *substream)
{ … }
static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip)
{ … }
#ifdef CONFIG_PM
static int snd_cmi8330_suspend(struct snd_card *card)
{ … }
static int snd_cmi8330_resume(struct snd_card *card)
{ … }
#endif
#ifdef CONFIG_PNP
#define is_isapnp_selected(dev) …
#else
#define is_isapnp_selected …
#endif
#define PFX …
static int snd_cmi8330_card_new(struct device *pdev, int dev,
struct snd_card **cardp)
{ … }
static int snd_cmi8330_probe(struct snd_card *card, int dev)
{ … }
static int snd_cmi8330_isa_match(struct device *pdev,
unsigned int dev)
{ … }
static int snd_cmi8330_isa_probe(struct device *pdev,
unsigned int dev)
{ … }
#ifdef CONFIG_PM
static int snd_cmi8330_isa_suspend(struct device *dev, unsigned int n,
pm_message_t state)
{ … }
static int snd_cmi8330_isa_resume(struct device *dev, unsigned int n)
{ … }
#endif
#define DEV_NAME …
static struct isa_driver snd_cmi8330_driver = …;
#ifdef CONFIG_PNP
static int snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
const struct pnp_card_device_id *pid)
{ … }
#ifdef CONFIG_PM
static int snd_cmi8330_pnp_suspend(struct pnp_card_link *pcard, pm_message_t state)
{ … }
static int snd_cmi8330_pnp_resume(struct pnp_card_link *pcard)
{ … }
#endif
static struct pnp_card_driver cmi8330_pnpc_driver = …;
#endif
static int __init alsa_card_cmi8330_init(void)
{ … }
static void __exit alsa_card_cmi8330_exit(void)
{ … }
module_init(…) …
module_exit(…)