#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 <linux/mutex.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
#include <sound/initval.h>
#define CARD_NAME …
#define DRIVER_NAME …
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static int index = …;
static char *id = …;
static int playback_bufsize = …;
static int capture_bufsize = …;
static bool force_ac97;
static int buffer_top;
static bool use_cache;
static bool vaio_hack;
static bool reset_workaround;
static bool reset_workaround_2;
module_param(index, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(id, charp, 0444);
MODULE_PARM_DESC(…) …;
module_param(playback_bufsize, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(capture_bufsize, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(force_ac97, bool, 0444);
MODULE_PARM_DESC(…) …;
module_param(buffer_top, int, 0444);
MODULE_PARM_DESC(…) …;
module_param(use_cache, bool, 0444);
MODULE_PARM_DESC(…) …;
module_param(vaio_hack, bool, 0444);
MODULE_PARM_DESC(…) …;
module_param(reset_workaround, bool, 0444);
MODULE_PARM_DESC(…) …;
module_param(reset_workaround_2, bool, 0444);
MODULE_PARM_DESC(…) …;
static bool enable;
module_param(enable, bool, 0444);
#define NM_SIGNATURE …
#define NM_SIG_MASK …
#define NM_PORT2_SIZE …
#define NM_MIXER_OFFSET …
#define NM_MAX_PLAYBACK_COEF_SIZE …
#define NM_MAX_RECORD_COEF_SIZE …
#define NM_INT_REG …
#define NM_PLAYBACK_INT …
#define NM_RECORD_INT …
#define NM_MISC_INT_1 …
#define NM_MISC_INT_2 …
#define NM_ACK_INT(chip, X) …
#define NM_MIXER_STATUS_OFFSET …
#define NM_MIXER_READY_MASK …
#define NM_MIXER_PRESENCE …
#define NM_PRESENCE_MASK …
#define NM_PRESENCE_VALUE …
#define NM2_PLAYBACK_INT …
#define NM2_RECORD_INT …
#define NM2_MISC_INT_1 …
#define NM2_MISC_INT_2 …
#define NM2_ACK_INT(chip, X) …
#define NM2_MIXER_STATUS_OFFSET …
#define NM2_MIXER_READY_MASK …
#define NM_PLAYBACK_REG_OFFSET …
#define NM_RECORD_REG_OFFSET …
#define NM_RATE_REG_OFFSET …
#define NM_RATE_STEREO …
#define NM_RATE_BITS_16 …
#define NM_RATE_MASK …
#define NM_PLAYBACK_ENABLE_REG …
#define NM_PLAYBACK_ENABLE_FLAG …
#define NM_PLAYBACK_ONESHOT …
#define NM_PLAYBACK_FREERUN …
#define NM_AUDIO_MUTE_REG …
#define NM_AUDIO_MUTE_LEFT …
#define NM_AUDIO_MUTE_RIGHT …
#define NM_RECORD_ENABLE_REG …
#define NM_RECORD_ENABLE_FLAG …
#define NM_RECORD_FREERUN …
#define NM_COEFF_START_OFFSET …
#define NM_COEFF_END_OFFSET …
#define NM_RBUFFER_START …
#define NM_RBUFFER_END …
#define NM_RBUFFER_WMARK …
#define NM_RBUFFER_CURRP …
#define NM_PBUFFER_START …
#define NM_PBUFFER_END …
#define NM_PBUFFER_WMARK …
#define NM_PBUFFER_CURRP …
struct nm256_stream { … };
struct nm256 { … };
#include "nm256_coef.c"
static const struct pci_device_id snd_nm256_ids[] = …;
MODULE_DEVICE_TABLE(pci, snd_nm256_ids);
static inline u8
snd_nm256_readb(struct nm256 *chip, int offset)
{ … }
static inline u16
snd_nm256_readw(struct nm256 *chip, int offset)
{ … }
static inline u32
snd_nm256_readl(struct nm256 *chip, int offset)
{ … }
static inline void
snd_nm256_writeb(struct nm256 *chip, int offset, u8 val)
{ … }
static inline void
snd_nm256_writew(struct nm256 *chip, int offset, u16 val)
{ … }
static inline void
snd_nm256_writel(struct nm256 *chip, int offset, u32 val)
{ … }
static inline void
snd_nm256_write_buffer(struct nm256 *chip, const void *src, int offset, int size)
{ … }
static u16
snd_nm256_get_start_offset(int which)
{ … }
static void
snd_nm256_load_one_coefficient(struct nm256 *chip, int stream, u32 port, int which)
{ … }
static void
snd_nm256_load_coefficient(struct nm256 *chip, int stream, int number)
{ … }
static const unsigned int samplerates[8] = …;
static const struct snd_pcm_hw_constraint_list constraints_rates = …;
static int
snd_nm256_fixed_rate(unsigned int rate)
{ … }
static void
snd_nm256_set_format(struct nm256 *chip, struct nm256_stream *s,
struct snd_pcm_substream *substream)
{ … }
static int snd_nm256_acquire_irq(struct nm256 *chip)
{ … }
static void snd_nm256_release_irq(struct nm256 *chip)
{ … }
static void snd_nm256_pcm_mark(struct nm256 *chip, struct nm256_stream *s, int reg)
{ … }
#define snd_nm256_playback_mark(chip, s) …
#define snd_nm256_capture_mark(chip, s) …
static void
snd_nm256_playback_start(struct nm256 *chip, struct nm256_stream *s,
struct snd_pcm_substream *substream)
{ … }
static void
snd_nm256_capture_start(struct nm256 *chip, struct nm256_stream *s,
struct snd_pcm_substream *substream)
{ … }
static void
snd_nm256_playback_stop(struct nm256 *chip)
{ … }
static void
snd_nm256_capture_stop(struct nm256 *chip)
{ … }
static int
snd_nm256_playback_trigger(struct snd_pcm_substream *substream, int cmd)
{ … }
static int
snd_nm256_capture_trigger(struct snd_pcm_substream *substream, int cmd)
{ … }
static int snd_nm256_pcm_prepare(struct snd_pcm_substream *substream)
{ … }
static snd_pcm_uframes_t
snd_nm256_playback_pointer(struct snd_pcm_substream *substream)
{ … }
static snd_pcm_uframes_t
snd_nm256_capture_pointer(struct snd_pcm_substream *substream)
{ … }
#ifndef __i386__
static int
snd_nm256_playback_silence(struct snd_pcm_substream *substream,
int channel, unsigned long pos, unsigned long count)
{ … }
static int
snd_nm256_playback_copy(struct snd_pcm_substream *substream,
int channel, unsigned long pos,
struct iov_iter *src, unsigned long count)
{ … }
static int
snd_nm256_capture_copy(struct snd_pcm_substream *substream,
int channel, unsigned long pos,
struct iov_iter *dst, unsigned long count)
{ … }
#endif
static void
snd_nm256_playback_update(struct nm256 *chip)
{ … }
static void
snd_nm256_capture_update(struct nm256 *chip)
{ … }
static const struct snd_pcm_hardware snd_nm256_playback = …;
static const struct snd_pcm_hardware snd_nm256_capture = …;
static int snd_nm256_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{ … }
static void snd_nm256_setup_stream(struct nm256 *chip, struct nm256_stream *s,
struct snd_pcm_substream *substream,
const struct snd_pcm_hardware *hw_ptr)
{ … }
static int
snd_nm256_playback_open(struct snd_pcm_substream *substream)
{ … }
static int
snd_nm256_capture_open(struct snd_pcm_substream *substream)
{ … }
static int
snd_nm256_playback_close(struct snd_pcm_substream *substream)
{ … }
static int
snd_nm256_capture_close(struct snd_pcm_substream *substream)
{ … }
static const struct snd_pcm_ops snd_nm256_playback_ops = …;
static const struct snd_pcm_ops snd_nm256_capture_ops = …;
static int
snd_nm256_pcm(struct nm256 *chip, int device)
{ … }
static void
snd_nm256_init_chip(struct nm256 *chip)
{ … }
static irqreturn_t
snd_nm256_intr_check(struct nm256 *chip)
{ … }
static irqreturn_t
snd_nm256_interrupt(int irq, void *dev_id)
{ … }
static irqreturn_t
snd_nm256_interrupt_zx(int irq, void *dev_id)
{ … }
static int
snd_nm256_ac97_ready(struct nm256 *chip)
{ … }
struct initialValues { … };
static const struct initialValues nm256_ac97_init_val[] = …;
static int nm256_ac97_idx(unsigned short reg)
{ … }
static unsigned short
snd_nm256_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
{ … }
static void
snd_nm256_ac97_write(struct snd_ac97 *ac97,
unsigned short reg, unsigned short val)
{ … }
static const struct snd_ac97_res_table nm256_res_table[] = …;
static void
snd_nm256_ac97_reset(struct snd_ac97 *ac97)
{ … }
static int
snd_nm256_mixer(struct nm256 *chip)
{ … }
static int
snd_nm256_peek_for_sig(struct nm256 *chip)
{ … }
static int nm256_suspend(struct device *dev)
{ … }
static int nm256_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(nm256_pm, nm256_suspend, nm256_resume);
static void snd_nm256_free(struct snd_card *card)
{ … }
static int
snd_nm256_create(struct snd_card *card, struct pci_dev *pci)
{ … }
enum { … };
static const struct snd_pci_quirk nm256_quirks[] = …;
static int snd_nm256_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{ … }
static struct pci_driver nm256_driver = …;
module_pci_driver(…) …;