#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include "pcxhr.h"
#include "pcxhr_mixer.h"
#include "pcxhr_hwdep.h"
#include "pcxhr_core.h"
#include "pcxhr_mix22.h"
#define DRIVER_NAME …
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static int index[SNDRV_CARDS] = …;
static char *id[SNDRV_CARDS] = …;
static bool enable[SNDRV_CARDS] = …;
static bool mono[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(…) …;
enum { … };
static const struct pci_device_id pcxhr_ids[] = …;
MODULE_DEVICE_TABLE(pci, pcxhr_ids);
struct board_parameters { … };
static const struct board_parameters pcxhr_board_params[] = …;
#define PCXHR_BOARD_HAS_AES1(x) …
#define PCXHR_BOARD_AESIN_NO_192K(x) …
static int pcxhr_pll_freq_register(unsigned int freq, unsigned int* pllreg,
unsigned int* realfreq)
{ … }
#define PCXHR_FREQ_REG_MASK …
#define PCXHR_FREQ_QUARTZ_48000 …
#define PCXHR_FREQ_QUARTZ_24000 …
#define PCXHR_FREQ_QUARTZ_12000 …
#define PCXHR_FREQ_QUARTZ_32000 …
#define PCXHR_FREQ_QUARTZ_16000 …
#define PCXHR_FREQ_QUARTZ_8000 …
#define PCXHR_FREQ_QUARTZ_44100 …
#define PCXHR_FREQ_QUARTZ_22050 …
#define PCXHR_FREQ_QUARTZ_11025 …
#define PCXHR_FREQ_PLL …
#define PCXHR_FREQ_QUARTZ_192000 …
#define PCXHR_FREQ_QUARTZ_96000 …
#define PCXHR_FREQ_QUARTZ_176400 …
#define PCXHR_FREQ_QUARTZ_88200 …
#define PCXHR_FREQ_QUARTZ_128000 …
#define PCXHR_FREQ_QUARTZ_64000 …
#define PCXHR_FREQ_WORD_CLOCK …
#define PCXHR_FREQ_SYNC_AES …
#define PCXHR_FREQ_AES_1 …
#define PCXHR_FREQ_AES_2 …
#define PCXHR_FREQ_AES_3 …
#define PCXHR_FREQ_AES_4 …
static int pcxhr_get_clock_reg(struct pcxhr_mgr *mgr, unsigned int rate,
unsigned int *reg, unsigned int *freq)
{ … }
static int pcxhr_sub_set_clock(struct pcxhr_mgr *mgr,
unsigned int rate,
int *changed)
{ … }
#define PCXHR_MODIFY_CLOCK_S_BIT …
#define PCXHR_IRQ_TIMER_FREQ …
#define PCXHR_IRQ_TIMER_PERIOD …
int pcxhr_set_clock(struct pcxhr_mgr *mgr, unsigned int rate)
{ … }
static int pcxhr_sub_get_external_clock(struct pcxhr_mgr *mgr,
enum pcxhr_clock_type clock_type,
int *sample_rate)
{ … }
int pcxhr_get_external_clock(struct pcxhr_mgr *mgr,
enum pcxhr_clock_type clock_type,
int *sample_rate)
{ … }
static int pcxhr_set_stream_state(struct snd_pcxhr *chip,
struct pcxhr_stream *stream)
{ … }
#define HEADER_FMT_BASE_LIN …
#define HEADER_FMT_BASE_FLOAT …
#define HEADER_FMT_INTEL …
#define HEADER_FMT_24BITS …
#define HEADER_FMT_16BITS …
#define HEADER_FMT_UPTO11 …
#define HEADER_FMT_UPTO32 …
#define HEADER_FMT_MONO …
static int pcxhr_set_format(struct pcxhr_stream *stream)
{ … }
static int pcxhr_update_r_buffer(struct pcxhr_stream *stream)
{ … }
#if 0
static int pcxhr_pipe_sample_count(struct pcxhr_stream *stream,
snd_pcm_uframes_t *sample_count)
{
struct pcxhr_rmh rmh;
int err;
pcxhr_t *chip = snd_pcm_substream_chip(stream->substream);
pcxhr_init_rmh(&rmh, CMD_PIPE_SAMPLE_COUNT);
pcxhr_set_pipe_cmd_params(&rmh, stream->pipe->is_capture, 0, 0,
1<<stream->pipe->first_audio);
err = pcxhr_send_msg(chip->mgr, &rmh);
if (err == 0) {
*sample_count = ((snd_pcm_uframes_t)rmh.stat[0]) << 24;
*sample_count += (snd_pcm_uframes_t)rmh.stat[1];
}
dev_dbg(chip->card->dev, "PIPE_SAMPLE_COUNT = %lx\n", *sample_count);
return err;
}
#endif
static inline int pcxhr_stream_scheduled_get_pipe(struct pcxhr_stream *stream,
struct pcxhr_pipe **pipe)
{ … }
static void pcxhr_start_linked_stream(struct pcxhr_mgr *mgr)
{ … }
static int pcxhr_trigger(struct snd_pcm_substream *subs, int cmd)
{ … }
static int pcxhr_hardware_timer(struct pcxhr_mgr *mgr, int start)
{ … }
static int pcxhr_prepare(struct snd_pcm_substream *subs)
{ … }
static int pcxhr_hw_params(struct snd_pcm_substream *subs,
struct snd_pcm_hw_params *hw)
{ … }
static const struct snd_pcm_hardware pcxhr_caps = …;
static int pcxhr_open(struct snd_pcm_substream *subs)
{ … }
static int pcxhr_close(struct snd_pcm_substream *subs)
{ … }
static snd_pcm_uframes_t pcxhr_stream_pointer(struct snd_pcm_substream *subs)
{ … }
static const struct snd_pcm_ops pcxhr_ops = …;
int pcxhr_create_pcm(struct snd_pcxhr *chip)
{ … }
static int pcxhr_chip_free(struct snd_pcxhr *chip)
{ … }
static int pcxhr_chip_dev_free(struct snd_device *device)
{ … }
static int pcxhr_create(struct pcxhr_mgr *mgr,
struct snd_card *card, int idx)
{ … }
static void pcxhr_proc_info(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ … }
static void pcxhr_proc_sync(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ … }
static void pcxhr_proc_gpio_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ … }
static void pcxhr_proc_gpo_write(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ … }
#define TIME_CODE_VALID_MASK …
#define TIME_CODE_NEW_MASK …
#define TIME_CODE_BACK_MASK …
#define TIME_CODE_WAIT_MASK …
#define MANAGE_SIGNAL_TIME_CODE …
#define MANAGE_SIGNAL_MIDI …
static void pcxhr_proc_ltc(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ … }
static void pcxhr_proc_init(struct snd_pcxhr *chip)
{ … }
static int pcxhr_free(struct pcxhr_mgr *mgr)
{ … }
static int pcxhr_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{ … }
static void pcxhr_remove(struct pci_dev *pci)
{ … }
static struct pci_driver pcxhr_driver = …;
module_pci_driver(…) …;