linux/sound/pci/ali5451/ali5451.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Matt Wu <[email protected]>
 *  Apr 26, 2001
 *  Routines for control of ALi pci audio M5451
 *
 *  BUGS:
 *    --
 *
 *  TODO:
 *    --
 */

#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/dma-mapping.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/info.h>
#include <sound/ac97_codec.h>
#include <sound/mpu401.h>
#include <sound/initval.h>

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

static int index =;	/* Index */
static char *id =;	/* ID for this card */
static int pcm_channels =;
static bool spdif;

module_param(index, int, 0444);
MODULE_PARM_DESC();
module_param(id, charp, 0444);
MODULE_PARM_DESC();
module_param(pcm_channels, int, 0444);
MODULE_PARM_DESC();
module_param(spdif, bool, 0444);
MODULE_PARM_DESC();

/* just for backward compatibility */
static bool enable;
module_param(enable, bool, 0444);


/*
 *  Constants definition
 */

#define DEVICE_ID_ALI5451


#define ALI_CHANNELS

#define ALI_PCM_IN_CHANNEL
#define ALI_SPDIF_IN_CHANNEL
#define ALI_SPDIF_OUT_CHANNEL
#define ALI_CENTER_CHANNEL
#define ALI_LEF_CHANNEL
#define ALI_SURR_LEFT_CHANNEL
#define ALI_SURR_RIGHT_CHANNEL
#define ALI_MODEM_IN_CHANNEL
#define ALI_MODEM_OUT_CHANNEL

#define SNDRV_ALI_VOICE_TYPE_PCM
#define SNDRV_ALI_VOICE_TYPE_OTH

#define ALI_5451_V02

/*
 *  Direct Registers
 */

#define ALI_LEGACY_DMAR0
#define ALI_LEGACY_DMAR4
#define ALI_LEGACY_DMAR11
#define ALI_LEGACY_DMAR15
#define ALI_MPUR0
#define ALI_MPUR1
#define ALI_MPUR2
#define ALI_MPUR3

#define ALI_AC97_WRITE
#define ALI_AC97_READ

#define ALI_SCTRL
#define ALI_SPDIF_OUT_ENABLE
#define ALI_SCTRL_LINE_IN2
#define ALI_SCTRL_GPIO_IN2
#define ALI_SCTRL_LINE_OUT_EN
#define ALI_SCTRL_GPIO_OUT_EN
#define ALI_SCTRL_CODEC1_READY
#define ALI_SCTRL_CODEC2_READY
#define ALI_AC97_GPIO
#define ALI_AC97_GPIO_ENABLE
#define ALI_AC97_GPIO_DATA_SHIFT
#define ALI_SPDIF_CS
#define ALI_SPDIF_CTRL
#define ALI_SPDIF_IN_FUNC_ENABLE
#define ALI_SPDIF_IN_CH_STATUS
#define ALI_SPDIF_OUT_CH_STATUS
#define ALI_START
#define ALI_STOP
#define ALI_CSPF
#define ALI_AINT
#define ALI_GC_CIR
	#define ENDLP_IE
	#define MIDLP_IE
#define ALI_AINTEN
#define ALI_VOLUME
#define ALI_SBDELTA_DELTA_R
#define ALI_MISCINT
	#define ADDRESS_IRQ
	#define TARGET_REACHED
	#define MIXER_OVERFLOW
	#define MIXER_UNDERFLOW
	#define GPIO_IRQ
#define ALI_SBBL_SBCL
#define ALI_SBCTRL_SBE2R_SBDD
#define ALI_STIMER
#define ALI_GLOBAL_CONTROL
#define ALI_SPDIF_OUT_SEL_PCM
#define ALI_SPDIF_IN_SUPPORT
#define ALI_SPDIF_OUT_CH_ENABLE
#define ALI_SPDIF_IN_CH_ENABLE
#define ALI_PCM_IN_ENABLE

#define ALI_CSO_ALPHA_FMS
#define ALI_LBA
#define ALI_ESO_DELTA
#define ALI_GVSEL_PAN_VOC_CTRL_EC
#define ALI_EBUF1
#define ALI_EBUF2

#define ALI_REG(codec, x)

#define MAX_CODECS


struct snd_ali;
struct snd_ali_voice;

struct snd_ali_channel_control {};

struct snd_ali_voice {};


struct snd_alidev {};


#define ALI_GLOBAL_REGS
#define ALI_CHANNEL_REGS
struct snd_ali_image {};


struct snd_ali {};

static const struct pci_device_id snd_ali_ids[] =;
MODULE_DEVICE_TABLE(pci, snd_ali_ids);

static void snd_ali_clear_voices(struct snd_ali *, unsigned int, unsigned int);
static unsigned short snd_ali_codec_peek(struct snd_ali *, int, unsigned short);
static void snd_ali_codec_poke(struct snd_ali *, int, unsigned short,
			       unsigned short);

/*
 *  AC97 ACCESS
 */

static inline unsigned int snd_ali_5451_peek(struct snd_ali *codec,
					     unsigned int port)
{}

static inline void snd_ali_5451_poke(struct snd_ali *codec,
				     unsigned int port,
				     unsigned int val)
{}

static int snd_ali_codec_ready(struct snd_ali *codec,
			       unsigned int port)
{}

static int snd_ali_stimer_ready(struct snd_ali *codec)
{}

static void snd_ali_codec_poke(struct snd_ali *codec,int secondary,
			       unsigned short reg,
			       unsigned short val)
{}

static unsigned short snd_ali_codec_peek(struct snd_ali *codec,
					 int secondary,
					 unsigned short reg)
{}

static void snd_ali_codec_write(struct snd_ac97 *ac97,
				unsigned short reg,
				unsigned short val )
{}


static unsigned short snd_ali_codec_read(struct snd_ac97 *ac97,
					 unsigned short reg)
{}

/*
 *	AC97 Reset
 */

static int snd_ali_reset_5451(struct snd_ali *codec)
{}

/*
 *  ALI 5451 Controller
 */

static void snd_ali_enable_special_channel(struct snd_ali *codec,
					   unsigned int channel)
{}

static void snd_ali_disable_special_channel(struct snd_ali *codec,
					    unsigned int channel)
{}

static void snd_ali_enable_address_interrupt(struct snd_ali *codec)
{}

static void snd_ali_disable_address_interrupt(struct snd_ali *codec)
{}

static void snd_ali_disable_voice_irq(struct snd_ali *codec,
				      unsigned int channel)
{}

static int snd_ali_alloc_pcm_channel(struct snd_ali *codec, int channel)
{}

static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
{}

static void snd_ali_free_channel_pcm(struct snd_ali *codec, int channel)
{}

static void snd_ali_stop_voice(struct snd_ali *codec, unsigned int channel)
{}

/*
 *    S/PDIF Part
 */

static void snd_ali_delay(struct snd_ali *codec,int interval)
{}

static void snd_ali_detect_spdif_rate(struct snd_ali *codec)
{}

static unsigned int snd_ali_get_spdif_in_rate(struct snd_ali *codec)
{}

static void snd_ali_enable_spdif_in(struct snd_ali *codec)
{}

static void snd_ali_disable_spdif_in(struct snd_ali *codec)
{}


static void snd_ali_set_spdif_out_rate(struct snd_ali *codec, unsigned int rate)
{}

static void snd_ali_enable_spdif_out(struct snd_ali *codec)
{}

static void snd_ali_enable_spdif_chnout(struct snd_ali *codec)
{}

static void snd_ali_disable_spdif_chnout(struct snd_ali *codec)
{}

static void snd_ali_disable_spdif_out(struct snd_ali *codec)
{}

static void snd_ali_update_ptr(struct snd_ali *codec, int channel)
{}

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


static struct snd_ali_voice *snd_ali_alloc_voice(struct snd_ali * codec,
						 int type, int rec, int channel)
{}


static void snd_ali_free_voice(struct snd_ali * codec,
			       struct snd_ali_voice *pvoice)
{}


static void snd_ali_clear_voices(struct snd_ali *codec,
				 unsigned int v_min,
				 unsigned int v_max)
{}

static void snd_ali_write_voice_regs(struct snd_ali *codec,
			 unsigned int Channel,
			 unsigned int LBA,
			 unsigned int CSO,
			 unsigned int ESO,
			 unsigned int DELTA,
			 unsigned int ALPHA_FMS,
			 unsigned int GVSEL,
			 unsigned int PAN,
			 unsigned int VOL,
			 unsigned int CTRL,
			 unsigned int EC)
{}

static unsigned int snd_ali_convert_rate(unsigned int rate, int rec)
{}

static unsigned int snd_ali_control_mode(struct snd_pcm_substream *substream)
{}

/*
 *  PCM part
 */

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

static int snd_ali_playback_hw_params(struct snd_pcm_substream *substream,
				      struct snd_pcm_hw_params *hw_params)
{}

static int snd_ali_playback_hw_free(struct snd_pcm_substream *substream)
{}

static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
{}


static int snd_ali_prepare(struct snd_pcm_substream *substream)
{}


static snd_pcm_uframes_t
snd_ali_playback_pointer(struct snd_pcm_substream *substream)
{}


static snd_pcm_uframes_t snd_ali_pointer(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_hardware snd_ali_playback =;

/*
 *  Capture support device description
 */

static const struct snd_pcm_hardware snd_ali_capture =;

static void snd_ali_pcm_free_substream(struct snd_pcm_runtime *runtime)
{}

static int snd_ali_open(struct snd_pcm_substream *substream, int rec,
			int channel, const struct snd_pcm_hardware *phw)
{}

static int snd_ali_playback_open(struct snd_pcm_substream *substream)
{}

static int snd_ali_capture_open(struct snd_pcm_substream *substream)
{}

static int snd_ali_playback_close(struct snd_pcm_substream *substream)
{}

static int snd_ali_close(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_ops snd_ali_playback_ops =;

static const struct snd_pcm_ops snd_ali_capture_ops =;

/*
 * Modem PCM
 */

static int snd_ali_modem_hw_params(struct snd_pcm_substream *substream,
				 struct snd_pcm_hw_params *hw_params)
{}

static const struct snd_pcm_hardware snd_ali_modem =;

static int snd_ali_modem_open(struct snd_pcm_substream *substream, int rec,
			      int channel)
{}

static int snd_ali_modem_playback_open(struct snd_pcm_substream *substream)
{}

static int snd_ali_modem_capture_open(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_ops snd_ali_modem_playback_ops =;

static const struct snd_pcm_ops snd_ali_modem_capture_ops =;


struct ali_pcm_description {};


static void snd_ali_pcm_free(struct snd_pcm *pcm)
{}


static int snd_ali_pcm(struct snd_ali *codec, int device,
		       struct ali_pcm_description *desc)
{}

static struct ali_pcm_description ali_pcms[] =;

static int snd_ali_build_pcms(struct snd_ali *codec)
{}


#define ALI5451_SPDIF(xname, xindex, value)

#define snd_ali5451_spdif_info

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

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

static const struct snd_kcontrol_new snd_ali5451_mixer_spdif[] =;

static int snd_ali_mixer(struct snd_ali *codec)
{}

static int ali_suspend(struct device *dev)
{}

static int ali_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(ali_pm, ali_suspend, ali_resume);

static void snd_ali_free(struct snd_card *card)
{}

static int snd_ali_chip_init(struct snd_ali *codec)
{}

/* proc for register dump */
static void snd_ali_proc_read(struct snd_info_entry *entry,
			      struct snd_info_buffer *buf)
{}

static void snd_ali_proc_init(struct snd_ali *codec)
{}

static int snd_ali_resources(struct snd_ali *codec)
{}

static int snd_ali_create(struct snd_card *card,
			  struct pci_dev *pci,
			  int pcm_streams,
			  int spdif_support)
{}

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

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

static struct pci_driver ali5451_driver =;                                

module_pci_driver();