#include <linux/io.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/gameport.h>
#include <linux/module.h>
#include <linux/dma-mapping.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/rawmidi.h>
#include <sound/mpu401.h>
#include <sound/opl3.h>
#include <sound/sb.h>
#include <sound/initval.h>
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
#if IS_REACHABLE(CONFIG_GAMEPORT)
#define SUPPORT_JOYSTICK …
#endif
static int index[SNDRV_CARDS] = …;
static char *id[SNDRV_CARDS] = …;
static bool enable[SNDRV_CARDS] = …;
#ifdef SUPPORT_JOYSTICK
static int joystick_port[SNDRV_CARDS];
#endif
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
#ifdef SUPPORT_JOYSTICK
module_param_hw_array(joystick_port, int, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
#endif
struct snd_card_als4000 { … };
static const struct pci_device_id snd_als4000_ids[] = …;
MODULE_DEVICE_TABLE(pci, snd_als4000_ids);
enum als4k_iobase_t { … };
enum als4k_iobase_0e_t { … };
enum als4k_gcr_t { … };
enum als4k_gcr8c_t { … };
static inline void snd_als4k_iobase_writeb(unsigned long iobase,
enum als4k_iobase_t reg,
u8 val)
{ … }
static inline void snd_als4k_iobase_writel(unsigned long iobase,
enum als4k_iobase_t reg,
u32 val)
{ … }
static inline u8 snd_als4k_iobase_readb(unsigned long iobase,
enum als4k_iobase_t reg)
{ … }
static inline u32 snd_als4k_iobase_readl(unsigned long iobase,
enum als4k_iobase_t reg)
{ … }
static inline void snd_als4k_gcr_write_addr(unsigned long iobase,
enum als4k_gcr_t reg,
u32 val)
{ … }
static inline void snd_als4k_gcr_write(struct snd_sb *sb,
enum als4k_gcr_t reg,
u32 val)
{ … }
static inline u32 snd_als4k_gcr_read_addr(unsigned long iobase,
enum als4k_gcr_t reg)
{ … }
static inline u32 snd_als4k_gcr_read(struct snd_sb *sb, enum als4k_gcr_t reg)
{ … }
enum als4k_cr_t { … };
enum als4k_cr0_t { … };
static inline void snd_als4_cr_write(struct snd_sb *chip,
enum als4k_cr_t reg,
u8 data)
{ … }
static inline u8 snd_als4_cr_read(struct snd_sb *chip,
enum als4k_cr_t reg)
{ … }
static void snd_als4000_set_rate(struct snd_sb *chip, unsigned int rate)
{ … }
static inline void snd_als4000_set_capture_dma(struct snd_sb *chip,
dma_addr_t addr, unsigned size)
{ … }
static inline void snd_als4000_set_playback_dma(struct snd_sb *chip,
dma_addr_t addr,
unsigned size)
{ … }
#define ALS4000_FORMAT_SIGNED …
#define ALS4000_FORMAT_16BIT …
#define ALS4000_FORMAT_STEREO …
static int snd_als4000_get_format(struct snd_pcm_runtime *runtime)
{ … }
static const struct { … } playback_cmd_vals[]= …;
#define playback_cmd(chip) …
enum { … };
static const unsigned char capture_cmd_vals[]= …;
#define capture_cmd(chip) …
static int snd_als4000_capture_prepare(struct snd_pcm_substream *substream)
{ … }
static int snd_als4000_playback_prepare(struct snd_pcm_substream *substream)
{ … }
static int snd_als4000_capture_trigger(struct snd_pcm_substream *substream, int cmd)
{ … }
static int snd_als4000_playback_trigger(struct snd_pcm_substream *substream, int cmd)
{ … }
static snd_pcm_uframes_t snd_als4000_capture_pointer(struct snd_pcm_substream *substream)
{ … }
static snd_pcm_uframes_t snd_als4000_playback_pointer(struct snd_pcm_substream *substream)
{ … }
static irqreturn_t snd_als4000_interrupt(int irq, void *dev_id)
{ … }
static const struct snd_pcm_hardware snd_als4000_playback = …;
static const struct snd_pcm_hardware snd_als4000_capture = …;
static int snd_als4000_playback_open(struct snd_pcm_substream *substream)
{ … }
static int snd_als4000_playback_close(struct snd_pcm_substream *substream)
{ … }
static int snd_als4000_capture_open(struct snd_pcm_substream *substream)
{ … }
static int snd_als4000_capture_close(struct snd_pcm_substream *substream)
{ … }
static const struct snd_pcm_ops snd_als4000_playback_ops = …;
static const struct snd_pcm_ops snd_als4000_capture_ops = …;
static int snd_als4000_pcm(struct snd_sb *chip, int device)
{ … }
static void snd_als4000_set_addr(unsigned long iobase,
unsigned int sb_io,
unsigned int mpu_io,
unsigned int opl_io,
unsigned int game_io)
{ … }
static void snd_als4000_configure(struct snd_sb *chip)
{ … }
#ifdef SUPPORT_JOYSTICK
static int snd_als4000_create_gameport(struct snd_card_als4000 *acard, int dev)
{ … }
static void snd_als4000_free_gameport(struct snd_card_als4000 *acard)
{ … }
#else
static inline int snd_als4000_create_gameport(struct snd_card_als4000 *acard, int dev) { return -ENOSYS; }
static inline void snd_als4000_free_gameport(struct snd_card_als4000 *acard) { }
#endif
static void snd_card_als4000_free( struct snd_card *card )
{ … }
static int __snd_card_als4000_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{ … }
static int snd_card_als4000_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{ … }
static int snd_als4000_suspend(struct device *dev)
{ … }
static int snd_als4000_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(snd_als4000_pm, snd_als4000_suspend, snd_als4000_resume);
static struct pci_driver als4000_driver = …;
module_pci_driver(…) …;