#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/rawmidi.h>
#include <sound/initval.h>
#include <sound/asoundef.h>
#include "ice1712.h"
#include "envy24ht.h"
#include "amp.h"
#include "revo.h"
#include "aureon.h"
#include "vt1720_mobo.h"
#include "pontis.h"
#include "prodigy192.h"
#include "prodigy_hifi.h"
#include "juli.h"
#include "maya44.h"
#include "phase.h"
#include "wtm.h"
#include "se.h"
#include "quartet.h"
#include "psc724.h"
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static int index[SNDRV_CARDS] = …;
static char *id[SNDRV_CARDS] = …;
static bool enable[SNDRV_CARDS] = …;
static char *model[SNDRV_CARDS];
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
module_param_array(…);
MODULE_PARM_DESC(…) …;
static const struct pci_device_id snd_vt1724_ids[] = …;
MODULE_DEVICE_TABLE(pci, snd_vt1724_ids);
static int PRO_RATE_LOCKED;
static int PRO_RATE_RESET = …;
static unsigned int PRO_RATE_DEFAULT = …;
static const char * const ext_clock_names[1] = …;
static inline int stdclock_is_spdif_master(struct snd_ice1712 *ice)
{ … }
static inline int is_pro_rate_locked(struct snd_ice1712 *ice)
{ … }
static unsigned char snd_vt1724_ac97_ready(struct snd_ice1712 *ice)
{ … }
static int snd_vt1724_ac97_wait_bit(struct snd_ice1712 *ice, unsigned char bit)
{ … }
static void snd_vt1724_ac97_write(struct snd_ac97 *ac97,
unsigned short reg,
unsigned short val)
{ … }
static unsigned short snd_vt1724_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
{ … }
static void snd_vt1724_set_gpio_dir(struct snd_ice1712 *ice, unsigned int data)
{ … }
static unsigned int snd_vt1724_get_gpio_dir(struct snd_ice1712 *ice)
{ … }
static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data)
{ … }
static unsigned int snd_vt1724_get_gpio_mask(struct snd_ice1712 *ice)
{ … }
static void snd_vt1724_set_gpio_data(struct snd_ice1712 *ice, unsigned int data)
{ … }
static unsigned int snd_vt1724_get_gpio_data(struct snd_ice1712 *ice)
{ … }
static void vt1724_midi_clear_rx(struct snd_ice1712 *ice)
{ … }
static inline struct snd_rawmidi_substream *
get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream)
{ … }
static void enable_midi_irq(struct snd_ice1712 *ice, u8 flag, int enable);
static void vt1724_midi_write(struct snd_ice1712 *ice)
{ … }
static void vt1724_midi_read(struct snd_ice1712 *ice)
{ … }
static void enable_midi_irq(struct snd_ice1712 *ice, u8 flag, int enable)
{ … }
static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
{ … }
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s)
{ … }
static int vt1724_midi_output_close(struct snd_rawmidi_substream *s)
{ … }
static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up)
{ … }
static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s)
{ … }
static const struct snd_rawmidi_ops vt1724_midi_output_ops = …;
static int vt1724_midi_input_open(struct snd_rawmidi_substream *s)
{ … }
static int vt1724_midi_input_close(struct snd_rawmidi_substream *s)
{ … }
static void vt1724_midi_input_trigger(struct snd_rawmidi_substream *s, int up)
{ … }
static const struct snd_rawmidi_ops vt1724_midi_input_ops = …;
static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id)
{ … }
static const unsigned int rates[] = …;
static const struct snd_pcm_hw_constraint_list hw_constraints_rates_96 = …;
static const struct snd_pcm_hw_constraint_list hw_constraints_rates_48 = …;
static const struct snd_pcm_hw_constraint_list hw_constraints_rates_192 = …;
struct vt1724_pcm_reg { … };
static int snd_vt1724_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{ … }
#define DMA_STARTS …
#define DMA_PAUSES …
static const unsigned int stdclock_rate_list[16] = …;
static unsigned int stdclock_get_rate(struct snd_ice1712 *ice)
{ … }
static void stdclock_set_rate(struct snd_ice1712 *ice, unsigned int rate)
{ … }
static unsigned char stdclock_set_mclk(struct snd_ice1712 *ice,
unsigned int rate)
{ … }
static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
int force)
{ … }
static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{ … }
static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream)
{ … }
static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_pcm_prepare(struct snd_pcm_substream *substream)
{ … }
static snd_pcm_uframes_t snd_vt1724_pcm_pointer(struct snd_pcm_substream *substream)
{ … }
static const struct vt1724_pcm_reg vt1724_pdma0_reg = …;
static const struct vt1724_pcm_reg vt1724_pdma4_reg = …;
static const struct vt1724_pcm_reg vt1724_rdma0_reg = …;
static const struct vt1724_pcm_reg vt1724_rdma1_reg = …;
#define vt1724_playback_pro_reg …
#define vt1724_playback_spdif_reg …
#define vt1724_capture_pro_reg …
#define vt1724_capture_spdif_reg …
static const struct snd_pcm_hardware snd_vt1724_playback_pro = …;
static const struct snd_pcm_hardware snd_vt1724_spdif = …;
static const struct snd_pcm_hardware snd_vt1724_2ch_stereo = …;
static void set_std_hw_rates(struct snd_ice1712 *ice)
{ … }
static int set_rate_constraints(struct snd_ice1712 *ice,
struct snd_pcm_substream *substream)
{ … }
static void constrain_rate_if_locked(struct snd_pcm_substream *substream)
{ … }
#define VT1724_BUFFER_ALIGN …
static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_capture_pro_open(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_playback_pro_close(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_capture_pro_close(struct snd_pcm_substream *substream)
{ … }
static const struct snd_pcm_ops snd_vt1724_playback_pro_ops = …;
static const struct snd_pcm_ops snd_vt1724_capture_pro_ops = …;
static int snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device)
{ … }
static void update_spdif_bits(struct snd_ice1712 *ice, unsigned int val)
{ … }
static void update_spdif_rate(struct snd_ice1712 *ice, unsigned int rate)
{ … }
static int snd_vt1724_playback_spdif_prepare(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_playback_spdif_open(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_playback_spdif_close(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_capture_spdif_open(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_capture_spdif_close(struct snd_pcm_substream *substream)
{ … }
static const struct snd_pcm_ops snd_vt1724_playback_spdif_ops = …;
static const struct snd_pcm_ops snd_vt1724_capture_spdif_ops = …;
static int snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device)
{ … }
static const struct vt1724_pcm_reg vt1724_playback_dma_regs[3] = …;
static int snd_vt1724_playback_indep_prepare(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_playback_indep_open(struct snd_pcm_substream *substream)
{ … }
static int snd_vt1724_playback_indep_close(struct snd_pcm_substream *substream)
{ … }
static const struct snd_pcm_ops snd_vt1724_playback_indep_ops = …;
static int snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device)
{ … }
static int snd_vt1724_ac97_mixer(struct snd_ice1712 *ice)
{ … }
static inline unsigned int eeprom_triple(struct snd_ice1712 *ice, int idx)
{ … }
static void snd_vt1724_proc_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ … }
static void snd_vt1724_proc_init(struct snd_ice1712 *ice)
{ … }
static int snd_vt1724_eeprom_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static int snd_vt1724_eeprom_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new snd_vt1724_eeprom = …;
static int snd_vt1724_spdif_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static unsigned int encode_spdif_bits(struct snd_aes_iec958 *diga)
{ … }
static void decode_spdif_bits(struct snd_aes_iec958 *diga, unsigned int val)
{ … }
static int snd_vt1724_spdif_default_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int snd_vt1724_spdif_default_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new snd_vt1724_spdif_default = …;
static int snd_vt1724_spdif_maskc_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int snd_vt1724_spdif_maskp_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new snd_vt1724_spdif_maskc = …;
static const struct snd_kcontrol_new snd_vt1724_spdif_maskp = …;
#define snd_vt1724_spdif_sw_info …
static int snd_vt1724_spdif_sw_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int snd_vt1724_spdif_sw_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new snd_vt1724_spdif_switch = …;
#if 0
#define snd_vt1724_gpio_info …
int snd_vt1724_gpio_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
int shift = kcontrol->private_value & 0xff;
int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0;
snd_ice1712_save_gpio_status(ice);
ucontrol->value.integer.value[0] =
(snd_ice1712_gpio_read(ice) & (1 << shift) ? 1 : 0) ^ invert;
snd_ice1712_restore_gpio_status(ice);
return 0;
}
int snd_ice1712_gpio_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
int shift = kcontrol->private_value & 0xff;
int invert = (kcontrol->private_value & (1<<24)) ? mask : 0;
unsigned int val, nval;
if (kcontrol->private_value & (1 << 31))
return -EPERM;
nval = (ucontrol->value.integer.value[0] ? (1 << shift) : 0) ^ invert;
snd_ice1712_save_gpio_status(ice);
val = snd_ice1712_gpio_read(ice);
nval |= val & ~(1 << shift);
if (val != nval)
snd_ice1712_gpio_write(ice, nval);
snd_ice1712_restore_gpio_status(ice);
return val != nval;
}
#endif
static int snd_vt1724_pro_internal_clock_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static int snd_vt1724_pro_internal_clock_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int stdclock_get_spdif_master_type(struct snd_ice1712 *ice)
{ … }
static int stdclock_set_spdif_clock(struct snd_ice1712 *ice, int type)
{ … }
static int snd_vt1724_pro_internal_clock_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new snd_vt1724_pro_internal_clock = …;
#define snd_vt1724_pro_rate_locking_info …
static int snd_vt1724_pro_rate_locking_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int snd_vt1724_pro_rate_locking_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new snd_vt1724_pro_rate_locking = …;
#define snd_vt1724_pro_rate_reset_info …
static int snd_vt1724_pro_rate_reset_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int snd_vt1724_pro_rate_reset_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new snd_vt1724_pro_rate_reset = …;
static int snd_vt1724_pro_route_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static inline int analog_route_shift(int idx)
{ … }
static inline int digital_route_shift(int idx)
{ … }
int snd_ice1724_get_route_val(struct snd_ice1712 *ice, int shift)
{ … }
int snd_ice1724_put_route_val(struct snd_ice1712 *ice, unsigned int val,
int shift)
{ … }
static int snd_vt1724_pro_route_analog_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int snd_vt1724_pro_route_analog_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int snd_vt1724_pro_route_spdif_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int snd_vt1724_pro_route_spdif_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route = …;
static const struct snd_kcontrol_new snd_vt1724_mixer_pro_spdif_route = …;
static int snd_vt1724_pro_peak_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static int snd_vt1724_pro_peak_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new snd_vt1724_mixer_pro_peak = …;
static const unsigned char ooaoo_sq210_eeprom[] = …;
static const struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] = …;
static const struct snd_ice1712_card_info *card_tables[] = …;
static void wait_i2c_busy(struct snd_ice1712 *ice)
{ … }
unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
unsigned char dev, unsigned char addr)
{ … }
void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
unsigned char dev, unsigned char addr, unsigned char data)
{ … }
static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
const char *modelname)
{ … }
static void snd_vt1724_chip_reset(struct snd_ice1712 *ice)
{ … }
static int snd_vt1724_chip_init(struct snd_ice1712 *ice)
{ … }
static int snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice)
{ … }
static int snd_vt1724_build_controls(struct snd_ice1712 *ice)
{ … }
static void snd_vt1724_free(struct snd_card *card)
{ … }
static int snd_vt1724_create(struct snd_card *card,
struct pci_dev *pci,
const char *modelname)
{ … }
static int __snd_vt1724_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{ … }
static int snd_vt1724_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{ … }
#ifdef CONFIG_PM_SLEEP
static int snd_vt1724_suspend(struct device *dev)
{ … }
static int snd_vt1724_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(snd_vt1724_pm, snd_vt1724_suspend, snd_vt1724_resume);
#define SND_VT1724_PM_OPS …
#else
#define SND_VT1724_PM_OPS …
#endif
static struct pci_driver vt1724_driver = …;
module_pci_driver(…) …;