#include <linux/io.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/info.h>
#include <sound/ac97_codec.h>
#include <sound/initval.h>
#if 0
#define POINTER_DEBUG
#endif
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static int index = …;
static char *id = …;
static int ac97_clock = …;
module_param(index, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(id, charp, 0444);
MODULE_PARM_DESC(…) …;
module_param(ac97_clock, int, 0444);
MODULE_PARM_DESC(…) …;
static bool enable;
module_param(enable, bool, 0444);
#define VIAREG(via, x) …
#define VIADEV_REG(viadev, x) …
#define VIA_REG_OFFSET_STATUS …
#define VIA_REG_STAT_ACTIVE …
#define VIA_REG_STAT_PAUSED …
#define VIA_REG_STAT_TRIGGER_QUEUED …
#define VIA_REG_STAT_STOPPED …
#define VIA_REG_STAT_EOL …
#define VIA_REG_STAT_FLAG …
#define VIA_REG_OFFSET_CONTROL …
#define VIA_REG_CTRL_START …
#define VIA_REG_CTRL_TERMINATE …
#define VIA_REG_CTRL_AUTOSTART …
#define VIA_REG_CTRL_PAUSE …
#define VIA_REG_CTRL_INT_STOP …
#define VIA_REG_CTRL_INT_EOL …
#define VIA_REG_CTRL_INT_FLAG …
#define VIA_REG_CTRL_RESET …
#define VIA_REG_CTRL_INT …
#define VIA_REG_OFFSET_TYPE …
#define VIA_REG_TYPE_AUTOSTART …
#define VIA_REG_TYPE_16BIT …
#define VIA_REG_TYPE_STEREO …
#define VIA_REG_TYPE_INT_LLINE …
#define VIA_REG_TYPE_INT_LSAMPLE …
#define VIA_REG_TYPE_INT_LESSONE …
#define VIA_REG_TYPE_INT_MASK …
#define VIA_REG_TYPE_INT_EOL …
#define VIA_REG_TYPE_INT_FLAG …
#define VIA_REG_OFFSET_TABLE_PTR …
#define VIA_REG_OFFSET_CURR_PTR …
#define VIA_REG_OFFSET_STOP_IDX …
#define VIA_REG_OFFSET_CURR_COUNT …
#define VIA_REG_OFFSET_CURR_INDEX …
#define DEFINE_VIA_REGSET(name,val) …
DEFINE_VIA_REGSET(MO, 0x40);
DEFINE_VIA_REGSET(MI, 0x50);
#define VIA_REG_AC97 …
#define VIA_REG_AC97_CODEC_ID_MASK …
#define VIA_REG_AC97_CODEC_ID_SHIFT …
#define VIA_REG_AC97_CODEC_ID_PRIMARY …
#define VIA_REG_AC97_CODEC_ID_SECONDARY …
#define VIA_REG_AC97_SECONDARY_VALID …
#define VIA_REG_AC97_PRIMARY_VALID …
#define VIA_REG_AC97_BUSY …
#define VIA_REG_AC97_READ …
#define VIA_REG_AC97_CMD_SHIFT …
#define VIA_REG_AC97_CMD_MASK …
#define VIA_REG_AC97_DATA_SHIFT …
#define VIA_REG_AC97_DATA_MASK …
#define VIA_REG_SGD_SHADOW …
#define VIA_REG_SGD_STAT_PB_FLAG …
#define VIA_REG_SGD_STAT_CP_FLAG …
#define VIA_REG_SGD_STAT_FM_FLAG …
#define VIA_REG_SGD_STAT_PB_EOL …
#define VIA_REG_SGD_STAT_CP_EOL …
#define VIA_REG_SGD_STAT_FM_EOL …
#define VIA_REG_SGD_STAT_PB_STOP …
#define VIA_REG_SGD_STAT_CP_STOP …
#define VIA_REG_SGD_STAT_FM_STOP …
#define VIA_REG_SGD_STAT_PB_ACTIVE …
#define VIA_REG_SGD_STAT_CP_ACTIVE …
#define VIA_REG_SGD_STAT_FM_ACTIVE …
#define VIA_REG_SGD_STAT_MR_FLAG …
#define VIA_REG_SGD_STAT_MW_FLAG …
#define VIA_REG_SGD_STAT_MR_EOL …
#define VIA_REG_SGD_STAT_MW_EOL …
#define VIA_REG_SGD_STAT_MR_STOP …
#define VIA_REG_SGD_STAT_MW_STOP …
#define VIA_REG_SGD_STAT_MR_ACTIVE …
#define VIA_REG_SGD_STAT_MW_ACTIVE …
#define VIA_REG_GPI_STATUS …
#define VIA_REG_GPI_INTR …
#define VIA_TBL_BIT_FLAG …
#define VIA_TBL_BIT_EOL …
#define VIA_ACLINK_STAT …
#define VIA_ACLINK_C11_READY …
#define VIA_ACLINK_C10_READY …
#define VIA_ACLINK_C01_READY …
#define VIA_ACLINK_LOWPOWER …
#define VIA_ACLINK_C00_READY …
#define VIA_ACLINK_CTRL …
#define VIA_ACLINK_CTRL_ENABLE …
#define VIA_ACLINK_CTRL_RESET …
#define VIA_ACLINK_CTRL_SYNC …
#define VIA_ACLINK_CTRL_SDO …
#define VIA_ACLINK_CTRL_VRA …
#define VIA_ACLINK_CTRL_PCM …
#define VIA_ACLINK_CTRL_FM …
#define VIA_ACLINK_CTRL_SB …
#define VIA_ACLINK_CTRL_INIT …
#define VIA_FUNC_ENABLE …
#define VIA_FUNC_MIDI_PNP …
#define VIA_FUNC_MIDI_IRQMASK …
#define VIA_FUNC_RX2C_WRITE …
#define VIA_FUNC_SB_FIFO_EMPTY …
#define VIA_FUNC_ENABLE_GAME …
#define VIA_FUNC_ENABLE_FM …
#define VIA_FUNC_ENABLE_MIDI …
#define VIA_FUNC_ENABLE_SB …
#define VIA_PNP_CONTROL …
#define VIA_MC97_CTRL …
#define VIA_MC97_CTRL_ENABLE …
#define VIA_MC97_CTRL_SECONDARY …
#define VIA_MC97_CTRL_INIT …
struct snd_via_sg_table { … } ;
#define VIA_TABLE_SIZE …
struct viadev { … };
enum { … };
#define VIA_MAX_MODEM_DEVS …
struct via82xx_modem { … };
static const struct pci_device_id snd_via82xx_modem_ids[] = …;
MODULE_DEVICE_TABLE(pci, snd_via82xx_modem_ids);
static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substream,
struct pci_dev *pci,
unsigned int periods, unsigned int fragsize)
{ … }
static int clean_via_table(struct viadev *dev, struct snd_pcm_substream *substream,
struct pci_dev *pci)
{ … }
static inline unsigned int snd_via82xx_codec_xread(struct via82xx_modem *chip)
{ … }
static inline void snd_via82xx_codec_xwrite(struct via82xx_modem *chip, unsigned int val)
{ … }
static int snd_via82xx_codec_ready(struct via82xx_modem *chip, int secondary)
{ … }
static int snd_via82xx_codec_valid(struct via82xx_modem *chip, int secondary)
{ … }
static void snd_via82xx_codec_wait(struct snd_ac97 *ac97)
{ … }
static void snd_via82xx_codec_write(struct snd_ac97 *ac97,
unsigned short reg,
unsigned short val)
{ … }
static unsigned short snd_via82xx_codec_read(struct snd_ac97 *ac97, unsigned short reg)
{ … }
static void snd_via82xx_channel_reset(struct via82xx_modem *chip, struct viadev *viadev)
{ … }
static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id)
{ … }
static int snd_via82xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{ … }
#define check_invalid_pos(viadev,pos) …
static inline unsigned int calc_linear_pos(struct via82xx_modem *chip,
struct viadev *viadev,
unsigned int idx,
unsigned int count)
{ … }
static snd_pcm_uframes_t snd_via686_pcm_pointer(struct snd_pcm_substream *substream)
{ … }
static int snd_via82xx_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{ … }
static int snd_via82xx_hw_free(struct snd_pcm_substream *substream)
{ … }
static void snd_via82xx_set_table_ptr(struct via82xx_modem *chip, struct viadev *viadev)
{ … }
static int snd_via82xx_pcm_prepare(struct snd_pcm_substream *substream)
{ … }
static const struct snd_pcm_hardware snd_via82xx_hw = …;
static int snd_via82xx_modem_pcm_open(struct via82xx_modem *chip, struct viadev *viadev,
struct snd_pcm_substream *substream)
{ … }
static int snd_via82xx_playback_open(struct snd_pcm_substream *substream)
{ … }
static int snd_via82xx_capture_open(struct snd_pcm_substream *substream)
{ … }
static int snd_via82xx_pcm_close(struct snd_pcm_substream *substream)
{ … }
static const struct snd_pcm_ops snd_via686_playback_ops = …;
static const struct snd_pcm_ops snd_via686_capture_ops = …;
static void init_viadev(struct via82xx_modem *chip, int idx, unsigned int reg_offset,
int direction)
{ … }
static int snd_via686_pcm_new(struct via82xx_modem *chip)
{ … }
static void snd_via82xx_mixer_free_ac97_bus(struct snd_ac97_bus *bus)
{ … }
static void snd_via82xx_mixer_free_ac97(struct snd_ac97 *ac97)
{ … }
static int snd_via82xx_mixer_new(struct via82xx_modem *chip)
{ … }
static void snd_via82xx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
{ … }
static void snd_via82xx_proc_init(struct via82xx_modem *chip)
{ … }
static int snd_via82xx_chip_init(struct via82xx_modem *chip)
{ … }
static int snd_via82xx_suspend(struct device *dev)
{ … }
static int snd_via82xx_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(snd_via82xx_pm, snd_via82xx_suspend, snd_via82xx_resume);
static void snd_via82xx_free(struct snd_card *card)
{ … }
static int snd_via82xx_create(struct snd_card *card,
struct pci_dev *pci,
int chip_type,
int revision,
unsigned int ac97_clock)
{ … }
static int __snd_via82xx_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{ … }
static int snd_via82xx_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{ … }
static struct pci_driver via82xx_modem_driver = …;
module_pci_driver(…) …;