#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/gameport.h>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/io.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/ac97_codec.h>
#include <sound/mpu401.h>
#include <sound/opl3.h>
#include <sound/initval.h>
#if IS_REACHABLE(CONFIG_GAMEPORT)
#define SUPPORT_JOYSTICK …
#endif
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_FIRMWARE(…) …;
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
static int mpu_port[SNDRV_CARDS] = …;
static int opl3_port[SNDRV_CARDS] = …;
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
module_param_hw_array(mpu_port, int, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
module_param_hw_array(opl3_port, int, ioport, NULL, 0444);
MODULE_PARM_DESC(…) …;
#define MPU401_HW_RIPTIDE …
#define OPL3_HW_RIPTIDE …
#define PCI_EXT_CapId …
#define PCI_EXT_NextCapPrt …
#define PCI_EXT_PWMC …
#define PCI_EXT_PWSCR …
#define PCI_EXT_Data00 …
#define PCI_EXT_PMSCR_BSE …
#define PCI_EXT_SB_Base …
#define PCI_EXT_FM_Base …
#define PCI_EXT_MPU_Base …
#define PCI_EXT_Game_Base …
#define PCI_EXT_Legacy_Mask …
#define PCI_EXT_AsicRev …
#define PCI_EXT_Reserved3 …
#define LEGACY_ENABLE_ALL …
#define LEGACY_ENABLE_SB …
#define LEGACY_ENABLE_FM …
#define LEGACY_ENABLE_MPU_INT …
#define LEGACY_ENABLE_MPU …
#define LEGACY_ENABLE_GAMEPORT …
#define MAX_WRITE_RETRY …
#define MAX_ERROR_COUNT …
#define CMDIF_TIMEOUT …
#define RESET_TRIES …
#define READ_PORT_ULONG(p) …
#define WRITE_PORT_ULONG(p,x) …
#define READ_AUDIO_CONTROL(p) …
#define WRITE_AUDIO_CONTROL(p,x) …
#define UMASK_AUDIO_CONTROL(p,x) …
#define MASK_AUDIO_CONTROL(p,x) …
#define READ_AUDIO_STATUS(p) …
#define SET_GRESET(p) …
#define UNSET_GRESET(p) …
#define SET_AIE(p) …
#define UNSET_AIE(p) …
#define SET_AIACK(p) …
#define UNSET_AIACKT(p) …
#define SET_ECMDAE(p) …
#define UNSET_ECMDAE(p) …
#define SET_ECMDBE(p) …
#define UNSET_ECMDBE(p) …
#define SET_EDATAF(p) …
#define UNSET_EDATAF(p) …
#define SET_EDATBF(p) …
#define UNSET_EDATBF(p) …
#define SET_ESBIRQON(p) …
#define UNSET_ESBIRQON(p) …
#define SET_EMPUIRQ(p) …
#define UNSET_EMPUIRQ(p) …
#define IS_CMDE(a) …
#define IS_DATF(a) …
#define IS_READY(p) …
#define IS_DLREADY(p) …
#define IS_DLERR(p) …
#define IS_GERR(p) …
#define IS_CMDAEIRQ(p) …
#define IS_CMDBEIRQ(p) …
#define IS_DATAFIRQ(p) …
#define IS_DATBFIRQ(p) …
#define IS_EOBIRQ(p) …
#define IS_EOSIRQ(p) …
#define IS_EOCIRQ(p) …
#define IS_UNSLIRQ(p) …
#define IS_SBIRQ(p) …
#define IS_MPUIRQ(p) …
#define RESP …
#define PARM …
#define CMDA …
#define CMDB …
#define NILL …
#define LONG0(a) …
#define BYTE0(a) …
#define BYTE1(a) …
#define BYTE2(a) …
#define BYTE3(a) …
#define WORD0(a) …
#define WORD1(a) …
#define WORD2(a) …
#define TRINIB0(a) …
#define TRINIB1(a) …
#define RET(a) …
#define SEND_GETV(p,b) …
#define SEND_GETC(p,b,c) …
#define SEND_GUNS(p,b) …
#define SEND_SCID(p,b) …
#define SEND_RMEM(p,b,c,d) …
#define SEND_SMEM(p,b,c) …
#define SEND_WMEM(p,b,c) …
#define SEND_SDTM(p,b,c) …
#define SEND_GOTO(p,b) …
#define SEND_SETDPLL(p) …
#define SEND_SSTR(p,b,c) …
#define SEND_PSTR(p,b) …
#define SEND_KSTR(p,b) …
#define SEND_KDMA(p) …
#define SEND_GPOS(p,b,c,d) …
#define SEND_SETF(p,b,c,d,e,f,g) …
#define SEND_GSTS(p,b,c,d) …
#define SEND_NGPOS(p,b,c,d) …
#define SEND_PSEL(p,b,c) …
#define SEND_PCLR(p,b,c) …
#define SEND_PLST(p,b) …
#define SEND_RSSV(p,b,c,d) …
#define SEND_LSEL(p,b,c,d,e,f,g,h) …
#define SEND_SSRC(p,b,c,d,e) …
#define SEND_SLST(p,b) …
#define SEND_RSRC(p,b,c) …
#define SEND_SSRB(p,b,c) …
#define SEND_SDGV(p,b,c,d,e) …
#define SEND_RDGV(p,b,c,d) …
#define SEND_DLST(p,b) …
#define SEND_SACR(p,b,c) …
#define SEND_RACR(p,b,c) …
#define SEND_ALST(p,b) …
#define SEND_TXAC(p,b,c,d,e,f) …
#define SEND_RXAC(p,b,c,d) …
#define SEND_SI2S(p,b) …
#define EOB_STATUS …
#define EOS_STATUS …
#define EOC_STATUS …
#define ERR_STATUS …
#define EMPTY_STATUS …
#define IEOB_ENABLE …
#define IEOS_ENABLE …
#define IEOC_ENABLE …
#define RDONCE …
#define DESC_MAX_MASK …
#define ST_PLAY …
#define ST_STOP …
#define ST_PAUSE …
#define I2S_INTDEC …
#define I2S_MERGER …
#define I2S_SPLITTER …
#define I2S_MIXER …
#define I2S_RATE …
#define MODEM_INTDEC …
#define MODEM_MERGER …
#define MODEM_SPLITTER …
#define MODEM_MIXER …
#define FM_INTDEC …
#define FM_MERGER …
#define FM_SPLITTER …
#define FM_MIXER …
#define SPLIT_PATH …
enum FIRMWARE { … };
enum CMDS { … };
enum E1SOURCE { … };
enum E2SINK { … };
enum LBUS_SINK { … };
enum RT_CHANNEL_IDS { … };
enum { … };
struct lbuspath { … };
struct cmdport { … };
struct riptideport { … };
struct cmdif { … };
struct riptide_firmware { … };
cmdret;
firmware_version;
#define get_pcmhwdev(substream) …
#define PLAYBACK_SUBSTREAMS …
struct snd_riptide { … };
struct sgd { … };
struct pcmhw { … };
#define CMDRET_ZERO …
static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
union cmdret *ret);
static int getsourcesink(struct cmdif *cif, unsigned char source,
unsigned char sink, unsigned char *a,
unsigned char *b);
static int snd_riptide_initialize(struct snd_riptide *chip);
static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip);
static const struct pci_device_id snd_riptide_ids[] = …;
#ifdef SUPPORT_JOYSTICK
static const struct pci_device_id snd_riptide_joystick_ids[] = …;
#endif
MODULE_DEVICE_TABLE(pci, snd_riptide_ids);
static const unsigned char lbusin2out[E2SINK_MAX + 1][2] = …;
static const unsigned char lbus_play_opl3[] = …;
static const unsigned char lbus_play_modem[] = …;
static const unsigned char lbus_play_i2s[] = …;
static const unsigned char lbus_play_out[] = …;
static const unsigned char lbus_play_outhp[] = …;
static const unsigned char lbus_play_noconv1[] = …;
static const unsigned char lbus_play_stereo1[] = …;
static const unsigned char lbus_play_mono1[] = …;
static const unsigned char lbus_play_noconv2[] = …;
static const unsigned char lbus_play_stereo2[] = …;
static const unsigned char lbus_play_mono2[] = …;
static const unsigned char lbus_play_noconv3[] = …;
static const unsigned char lbus_play_stereo3[] = …;
static const unsigned char lbus_play_mono3[] = …;
static const unsigned char lbus_rec_noconv1[] = …;
static const unsigned char lbus_rec_stereo1[] = …;
static const unsigned char lbus_rec_mono1[] = …;
static const unsigned char play_ids[] = …;
static const unsigned char play_sources[] = …;
static const struct lbuspath lbus_play_paths[] = …;
static const struct lbuspath lbus_rec_path = …;
#define FIRMWARE_VERSIONS …
static union firmware_version firmware_versions[] = …;
static u32 atoh(const unsigned char *in, unsigned int len)
{ … }
static int senddata(struct cmdif *cif, const unsigned char *in, u32 offset)
{ … }
static int loadfirmware(struct cmdif *cif, const unsigned char *img,
unsigned int size)
{ … }
static void
alloclbuspath(struct cmdif *cif, unsigned char source,
const unsigned char *path, unsigned char *mixer, unsigned char *s)
{ … }
static void
freelbuspath(struct cmdif *cif, unsigned char source, const unsigned char *path)
{ … }
static int writearm(struct cmdif *cif, u32 addr, u32 data, u32 mask)
{ … }
static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
union cmdret *ret)
{ … }
static int
setmixer(struct cmdif *cif, short num, unsigned short rval, unsigned short lval)
{ … }
static int getpaths(struct cmdif *cif, unsigned char *o)
{ … }
static int
getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink,
unsigned char *a, unsigned char *b)
{ … }
static int
getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate)
{ … }
static int
setsampleformat(struct cmdif *cif,
unsigned char mixer, unsigned char id,
unsigned char channels, snd_pcm_format_t format)
{ … }
static int
setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate)
{ … }
static int
getmixer(struct cmdif *cif, short num, unsigned short *rval,
unsigned short *lval)
{ … }
static irqreturn_t riptide_handleirq(int irq, void *dev_id)
{ … }
static int riptide_suspend(struct device *dev)
{ … }
static int riptide_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(riptide_pm, riptide_suspend, riptide_resume);
static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip)
{ … }
static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip)
{ … }
static const struct snd_pcm_hardware snd_riptide_playback = …;
static const struct snd_pcm_hardware snd_riptide_capture = …;
static snd_pcm_uframes_t snd_riptide_pointer(struct snd_pcm_substream
*substream)
{ … }
static int snd_riptide_trigger(struct snd_pcm_substream *substream, int cmd)
{ … }
static int snd_riptide_prepare(struct snd_pcm_substream *substream)
{ … }
static int
snd_riptide_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{ … }
static int snd_riptide_hw_free(struct snd_pcm_substream *substream)
{ … }
static int snd_riptide_playback_open(struct snd_pcm_substream *substream)
{ … }
static int snd_riptide_capture_open(struct snd_pcm_substream *substream)
{ … }
static int snd_riptide_playback_close(struct snd_pcm_substream *substream)
{ … }
static int snd_riptide_capture_close(struct snd_pcm_substream *substream)
{ … }
static const struct snd_pcm_ops snd_riptide_playback_ops = …;
static const struct snd_pcm_ops snd_riptide_capture_ops = …;
static int snd_riptide_pcm(struct snd_riptide *chip, int device)
{ … }
static irqreturn_t
snd_riptide_interrupt(int irq, void *dev_id)
{ … }
static void
snd_riptide_codec_write(struct snd_ac97 *ac97, unsigned short reg,
unsigned short val)
{ … }
static unsigned short snd_riptide_codec_read(struct snd_ac97 *ac97,
unsigned short reg)
{ … }
static int snd_riptide_initialize(struct snd_riptide *chip)
{ … }
static void snd_riptide_free(struct snd_card *card)
{ … }
static int
snd_riptide_create(struct snd_card *card, struct pci_dev *pci)
{ … }
static void
snd_riptide_proc_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ … }
static void snd_riptide_proc_init(struct snd_riptide *chip)
{ … }
static int snd_riptide_mixer(struct snd_riptide *chip)
{ … }
#ifdef SUPPORT_JOYSTICK
static int
snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id)
{ … }
static void snd_riptide_joystick_remove(struct pci_dev *pci)
{ … }
#endif
static int
__snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
{ … }
static int
snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
{ … }
static struct pci_driver driver = …;
#ifdef SUPPORT_JOYSTICK
static struct pci_driver joystick_driver = …;
#endif
static int __init alsa_card_riptide_init(void)
{ … }
static void __exit alsa_card_riptide_exit(void)
{ … }
module_init(…) …;
module_exit(alsa_card_riptide_exit);