linux/sound/pci/rme96.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *   ALSA driver for RME Digi96, Digi96/8 and Digi96/8 PRO/PAD/PST audio
 *   interfaces 
 *
 *	Copyright (c) 2000, 2001 Anders Torger <[email protected]>
 *    
 *      Thanks to Henk Hesselink <[email protected]> for the analog volume control
 *      code.
 */      

#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/vmalloc.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/asoundef.h>
#include <sound/initval.h>

/* note, two last pcis should be equal, it is not a bug */

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

static int index[SNDRV_CARDS] =;	/* Index 0-MAX */
static char *id[SNDRV_CARDS] =;	/* ID for this card */
static bool enable[SNDRV_CARDS] =;	/* Enable this card */

module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();

/*
 * Defines for RME Digi96 series, from internal RME reference documents
 * dated 12.01.00
 */

#define RME96_SPDIF_NCHANNELS

/* Playback and capture buffer size */
#define RME96_BUFFER_SIZE

/* IO area size */
#define RME96_IO_SIZE

/* IO area offsets */
#define RME96_IO_PLAY_BUFFER
#define RME96_IO_REC_BUFFER
#define RME96_IO_CONTROL_REGISTER
#define RME96_IO_ADDITIONAL_REG
#define RME96_IO_CONFIRM_PLAY_IRQ
#define RME96_IO_CONFIRM_REC_IRQ
#define RME96_IO_SET_PLAY_POS
#define RME96_IO_RESET_PLAY_POS
#define RME96_IO_SET_REC_POS
#define RME96_IO_RESET_REC_POS
#define RME96_IO_GET_PLAY_POS
#define RME96_IO_GET_REC_POS

/* Write control register bits */
#define RME96_WCR_START
#define RME96_WCR_START_2
#define RME96_WCR_GAIN_0
#define RME96_WCR_GAIN_1
#define RME96_WCR_MODE24
#define RME96_WCR_MODE24_2
#define RME96_WCR_BM
#define RME96_WCR_BM_2
#define RME96_WCR_ADAT
#define RME96_WCR_FREQ_0
#define RME96_WCR_FREQ_1
#define RME96_WCR_DS
#define RME96_WCR_PRO
#define RME96_WCR_EMP
#define RME96_WCR_SEL
#define RME96_WCR_MASTER
#define RME96_WCR_PD
#define RME96_WCR_INP_0
#define RME96_WCR_INP_1
#define RME96_WCR_THRU_0
#define RME96_WCR_THRU_1
#define RME96_WCR_THRU_2
#define RME96_WCR_THRU_3
#define RME96_WCR_THRU_4
#define RME96_WCR_THRU_5
#define RME96_WCR_THRU_6
#define RME96_WCR_THRU_7
#define RME96_WCR_DOLBY
#define RME96_WCR_MONITOR_0
#define RME96_WCR_MONITOR_1
#define RME96_WCR_ISEL
#define RME96_WCR_IDIS

#define RME96_WCR_BITPOS_GAIN_0
#define RME96_WCR_BITPOS_GAIN_1
#define RME96_WCR_BITPOS_FREQ_0
#define RME96_WCR_BITPOS_FREQ_1
#define RME96_WCR_BITPOS_INP_0
#define RME96_WCR_BITPOS_INP_1
#define RME96_WCR_BITPOS_MONITOR_0
#define RME96_WCR_BITPOS_MONITOR_1

/* Read control register bits */
#define RME96_RCR_AUDIO_ADDR_MASK
#define RME96_RCR_IRQ_2
#define RME96_RCR_T_OUT
#define RME96_RCR_DEV_ID_0
#define RME96_RCR_DEV_ID_1
#define RME96_RCR_LOCK
#define RME96_RCR_VERF
#define RME96_RCR_F0
#define RME96_RCR_F1
#define RME96_RCR_F2
#define RME96_RCR_AUTOSYNC
#define RME96_RCR_IRQ

#define RME96_RCR_BITPOS_F0
#define RME96_RCR_BITPOS_F1
#define RME96_RCR_BITPOS_F2

/* Additional register bits */
#define RME96_AR_WSEL
#define RME96_AR_ANALOG
#define RME96_AR_FREQPAD_0
#define RME96_AR_FREQPAD_1
#define RME96_AR_FREQPAD_2
#define RME96_AR_PD2
#define RME96_AR_DAC_EN
#define RME96_AR_CLATCH
#define RME96_AR_CCLK
#define RME96_AR_CDATA

#define RME96_AR_BITPOS_F0
#define RME96_AR_BITPOS_F1
#define RME96_AR_BITPOS_F2

/* Monitor tracks */
#define RME96_MONITOR_TRACKS_1_2
#define RME96_MONITOR_TRACKS_3_4
#define RME96_MONITOR_TRACKS_5_6
#define RME96_MONITOR_TRACKS_7_8

/* Attenuation */
#define RME96_ATTENUATION_0
#define RME96_ATTENUATION_6
#define RME96_ATTENUATION_12
#define RME96_ATTENUATION_18

/* Input types */
#define RME96_INPUT_OPTICAL
#define RME96_INPUT_COAXIAL
#define RME96_INPUT_INTERNAL
#define RME96_INPUT_XLR
#define RME96_INPUT_ANALOG

/* Clock modes */
#define RME96_CLOCKMODE_SLAVE
#define RME96_CLOCKMODE_MASTER
#define RME96_CLOCKMODE_WORDCLOCK

/* Block sizes in bytes */
#define RME96_SMALL_BLOCK_SIZE
#define RME96_LARGE_BLOCK_SIZE

/* Volume control */
#define RME96_AD1852_VOL_BITS
#define RME96_AD1855_VOL_BITS

/* Defines for snd_rme96_trigger */
#define RME96_TB_START_PLAYBACK
#define RME96_TB_START_CAPTURE
#define RME96_TB_STOP_PLAYBACK
#define RME96_TB_STOP_CAPTURE
#define RME96_TB_RESET_PLAYPOS
#define RME96_TB_RESET_CAPTUREPOS
#define RME96_TB_CLEAR_PLAYBACK_IRQ
#define RME96_TB_CLEAR_CAPTURE_IRQ
#define RME96_RESUME_PLAYBACK
#define RME96_RESUME_CAPTURE
#define RME96_RESUME_BOTH
#define RME96_START_PLAYBACK
#define RME96_START_CAPTURE
#define RME96_START_BOTH
#define RME96_STOP_PLAYBACK
#define RME96_STOP_CAPTURE
#define RME96_STOP_BOTH

struct rme96 {};

static const struct pci_device_id snd_rme96_ids[] =;

MODULE_DEVICE_TABLE(pci, snd_rme96_ids);

#define RME96_ISPLAYING(rme96)
#define RME96_ISRECORDING(rme96)
#define RME96_HAS_ANALOG_IN(rme96)
#define RME96_HAS_ANALOG_OUT(rme96)
#define RME96_DAC_IS_1852(rme96)
#define RME96_DAC_IS_1855(rme96)
#define RME96_185X_MAX_OUT(rme96)

static int
snd_rme96_playback_prepare(struct snd_pcm_substream *substream);

static int
snd_rme96_capture_prepare(struct snd_pcm_substream *substream);

static int
snd_rme96_playback_trigger(struct snd_pcm_substream *substream, 
			   int cmd);

static int
snd_rme96_capture_trigger(struct snd_pcm_substream *substream, 
			  int cmd);

static snd_pcm_uframes_t
snd_rme96_playback_pointer(struct snd_pcm_substream *substream);

static snd_pcm_uframes_t
snd_rme96_capture_pointer(struct snd_pcm_substream *substream);

static void snd_rme96_proc_init(struct rme96 *rme96);

static int
snd_rme96_create_switches(struct snd_card *card,
			  struct rme96 *rme96);

static int
snd_rme96_getinputtype(struct rme96 *rme96);

static inline unsigned int
snd_rme96_playback_ptr(struct rme96 *rme96)
{}

static inline unsigned int
snd_rme96_capture_ptr(struct rme96 *rme96)
{}

static int
snd_rme96_playback_silence(struct snd_pcm_substream *substream,
			   int channel, unsigned long pos, unsigned long count)
{}

static int
snd_rme96_playback_copy(struct snd_pcm_substream *substream,
			int channel, unsigned long pos,
			struct iov_iter *src, unsigned long count)
{}

static int
snd_rme96_capture_copy(struct snd_pcm_substream *substream,
		       int channel, unsigned long pos,
		       struct iov_iter *dst, unsigned long count)
{}

/*
 * Digital output capabilities (S/PDIF)
 */
static const struct snd_pcm_hardware snd_rme96_playback_spdif_info =;

/*
 * Digital input capabilities (S/PDIF)
 */
static const struct snd_pcm_hardware snd_rme96_capture_spdif_info =;

/*
 * Digital output capabilities (ADAT)
 */
static const struct snd_pcm_hardware snd_rme96_playback_adat_info =;

/*
 * Digital input capabilities (ADAT)
 */
static const struct snd_pcm_hardware snd_rme96_capture_adat_info =;

/*
 * The CDATA, CCLK and CLATCH bits can be used to write to the SPI interface
 * of the AD1852 or AD1852 D/A converter on the board.  CDATA must be set up
 * on the falling edge of CCLK and be stable on the rising edge.  The rising
 * edge of CLATCH after the last data bit clocks in the whole data word.
 * A fast processor could probably drive the SPI interface faster than the
 * DAC can handle (3MHz for the 1855, unknown for the 1852).  The udelay(1)
 * limits the data rate to 500KHz and only causes a delay of 33 microsecs.
 *
 * NOTE: increased delay from 1 to 10, since there where problems setting
 * the volume.
 */
static void
snd_rme96_write_SPI(struct rme96 *rme96, u16 val)
{}

static void
snd_rme96_apply_dac_volume(struct rme96 *rme96)
{}

static void
snd_rme96_reset_dac(struct rme96 *rme96)
{}

static int
snd_rme96_getmontracks(struct rme96 *rme96)
{}

static int
snd_rme96_setmontracks(struct rme96 *rme96,
		       int montracks)
{}

static int
snd_rme96_getattenuation(struct rme96 *rme96)
{}

static int
snd_rme96_setattenuation(struct rme96 *rme96,
			 int attenuation)
{}

static int
snd_rme96_capture_getrate(struct rme96 *rme96,
			  int *is_adat)
{}

static int
snd_rme96_playback_getrate(struct rme96 *rme96)
{}

static int
snd_rme96_playback_setrate(struct rme96 *rme96,
			   int rate)
{}

static int
snd_rme96_capture_analog_setrate(struct rme96 *rme96,
				 int rate)
{}

static int
snd_rme96_setclockmode(struct rme96 *rme96,
		       int mode)
{}

static int
snd_rme96_getclockmode(struct rme96 *rme96)
{}

static int
snd_rme96_setinputtype(struct rme96 *rme96,
		       int type)
{}

static int
snd_rme96_getinputtype(struct rme96 *rme96)
{}

static void
snd_rme96_setframelog(struct rme96 *rme96,
		      int n_channels,
		      int is_playback)
{}

static int
snd_rme96_playback_setformat(struct rme96 *rme96, snd_pcm_format_t format)
{}

static int
snd_rme96_capture_setformat(struct rme96 *rme96, snd_pcm_format_t format)
{}

static void
snd_rme96_set_period_properties(struct rme96 *rme96,
				size_t period_bytes)
{}

static int
snd_rme96_playback_hw_params(struct snd_pcm_substream *substream,
			     struct snd_pcm_hw_params *params)
{}

static int
snd_rme96_capture_hw_params(struct snd_pcm_substream *substream,
			    struct snd_pcm_hw_params *params)
{}

static void
snd_rme96_trigger(struct rme96 *rme96,
		  int op)
{}



static irqreturn_t
snd_rme96_interrupt(int irq,
		    void *dev_id)
{}

static const unsigned int period_bytes[] =;

static const struct snd_pcm_hw_constraint_list hw_constraints_period_bytes =;

static void
rme96_set_buffer_size_constraint(struct rme96 *rme96,
				 struct snd_pcm_runtime *runtime)
{}

static int
snd_rme96_playback_spdif_open(struct snd_pcm_substream *substream)
{}

static int
snd_rme96_capture_spdif_open(struct snd_pcm_substream *substream)
{}

static int
snd_rme96_playback_adat_open(struct snd_pcm_substream *substream)
{}

static int
snd_rme96_capture_adat_open(struct snd_pcm_substream *substream)
{}

static int
snd_rme96_playback_close(struct snd_pcm_substream *substream)
{}

static int
snd_rme96_capture_close(struct snd_pcm_substream *substream)
{}

static int
snd_rme96_playback_prepare(struct snd_pcm_substream *substream)
{}

static int
snd_rme96_capture_prepare(struct snd_pcm_substream *substream)
{}

static int
snd_rme96_playback_trigger(struct snd_pcm_substream *substream, 
			   int cmd)
{}

static int
snd_rme96_capture_trigger(struct snd_pcm_substream *substream, 
			  int cmd)
{}

static snd_pcm_uframes_t
snd_rme96_playback_pointer(struct snd_pcm_substream *substream)
{}

static snd_pcm_uframes_t
snd_rme96_capture_pointer(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_ops snd_rme96_playback_spdif_ops =;

static const struct snd_pcm_ops snd_rme96_capture_spdif_ops =;

static const struct snd_pcm_ops snd_rme96_playback_adat_ops =;

static const struct snd_pcm_ops snd_rme96_capture_adat_ops =;

static void
snd_rme96_free(struct rme96 *rme96)
{}

static void
snd_rme96_free_spdif_pcm(struct snd_pcm *pcm)
{}

static void
snd_rme96_free_adat_pcm(struct snd_pcm *pcm)
{}

static int
snd_rme96_create(struct rme96 *rme96)
{}

/*
 * proc interface
 */

static void 
snd_rme96_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
{}

static void snd_rme96_proc_init(struct rme96 *rme96)
{}

/*
 * control interface
 */

#define snd_rme96_info_loopback_control

static int
snd_rme96_get_loopback_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}
static int
snd_rme96_put_loopback_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int
snd_rme96_info_inputtype_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}
static int
snd_rme96_get_inputtype_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}
static int
snd_rme96_put_inputtype_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int
snd_rme96_info_clockmode_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}
static int
snd_rme96_get_clockmode_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}
static int
snd_rme96_put_clockmode_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int
snd_rme96_info_attenuation_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}
static int
snd_rme96_get_attenuation_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}
static int
snd_rme96_put_attenuation_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int
snd_rme96_info_montracks_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}
static int
snd_rme96_get_montracks_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}
static int
snd_rme96_put_montracks_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static u32 snd_rme96_convert_from_aes(struct snd_aes_iec958 *aes)
{}

static void snd_rme96_convert_to_aes(struct snd_aes_iec958 *aes, u32 val)
{}

static int snd_rme96_control_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}

static int snd_rme96_control_spdif_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int snd_rme96_control_spdif_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int snd_rme96_control_spdif_stream_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}

static int snd_rme96_control_spdif_stream_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int snd_rme96_control_spdif_stream_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int snd_rme96_control_spdif_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}

static int snd_rme96_control_spdif_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{}

static int
snd_rme96_dac_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{}

static int
snd_rme96_dac_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u)
{}

static int
snd_rme96_dac_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u)
{}

static const struct snd_kcontrol_new snd_rme96_controls[] =;

static int
snd_rme96_create_switches(struct snd_card *card,
			  struct rme96 *rme96)
{}

/*
 * Card initialisation
 */

static int rme96_suspend(struct device *dev)
{}

static int rme96_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(rme96_pm, rme96_suspend, rme96_resume);

static void snd_rme96_card_free(struct snd_card *card)
{}

static int
__snd_rme96_probe(struct pci_dev *pci,
		  const struct pci_device_id *pci_id)
{}

static int snd_rme96_probe(struct pci_dev *pci,
			   const struct pci_device_id *pci_id)
{}

static struct pci_driver rme96_driver =;

module_pci_driver();