linux/sound/pci/ice1712/ice1712.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *   ALSA driver for ICEnsemble ICE1712 (Envy24)
 *
 *	Copyright (c) 2000 Jaroslav Kysela <[email protected]>
 */

/*
  NOTES:
  - spdif nonaudio consumer mode does not work (at least with my
    Sony STR-DB830)
*/

/*
 * Changes:
 *
 *  2002.09.09	Takashi Iwai <[email protected]>
 *	split the code to several files.  each low-level routine
 *	is stored in the local file and called from registration
 *	function from card_info struct.
 *
 *  2002.11.26	James Stafford <[email protected]>
 *	Added support for VT1724 (Envy24HT)
 *	I have left out support for 176.4 and 192 KHz for the moment.
 *  I also haven't done anything with the internal S/PDIF transmitter or the MPU-401
 *
 *  2003.02.20  Taksahi Iwai <[email protected]>
 *	Split vt1724 part to an independent driver.
 *	The GPIO is accessed through the callback functions now.
 *
 * 2004.03.31 Doug McLain <[email protected]>
 *    Added support for Event Electronics EZ8 card to hoontech.c.
 */


#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/mutex.h>

#include <sound/core.h>
#include <sound/cs8427.h>
#include <sound/info.h>
#include <sound/initval.h>
#include <sound/tlv.h>

#include <sound/asoundef.h>

#include "ice1712.h"

/* lowlevel routines */
#include "delta.h"
#include "ews.h"
#include "hoontech.h"

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 */
static char *model[SNDRV_CARDS];
static bool omni[SNDRV_CARDS];				/* Delta44 & 66 Omni I/O support */
static int cs8427_timeout[SNDRV_CARDS] =; /* CS8427 S/PDIF transceiver reset timeout value in msec */
static int dxr_enable[SNDRV_CARDS];			/* DXR enable for DMX6FIRE */

module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();
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_ice1712_ids[] =;

MODULE_DEVICE_TABLE(pci, snd_ice1712_ids);

static int snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice);
static int snd_ice1712_build_controls(struct snd_ice1712 *ice);

static int PRO_RATE_LOCKED;
static int PRO_RATE_RESET =;
static unsigned int PRO_RATE_DEFAULT =;

/*
 *  Basic I/O
 */

/* check whether the clock mode is spdif-in */
static inline int is_spdif_master(struct snd_ice1712 *ice)
{}

static inline int is_pro_rate_locked(struct snd_ice1712 *ice)
{}

static inline void snd_ice1712_ds_write(struct snd_ice1712 *ice, u8 channel, u8 addr, u32 data)
{}

static inline u32 snd_ice1712_ds_read(struct snd_ice1712 *ice, u8 channel, u8 addr)
{}

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

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

/*
 * pro ac97 section
 */

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


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

/*
 * consumer ac97 digital mix
 */
#define snd_ice1712_digmix_route_ac97_info

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

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

static const struct snd_kcontrol_new snd_ice1712_mixer_digmix_route_ac97 =;


/*
 * gpio operations
 */
static void snd_ice1712_set_gpio_dir(struct snd_ice1712 *ice, unsigned int data)
{}

static unsigned int snd_ice1712_get_gpio_dir(struct snd_ice1712 *ice)
{}

static unsigned int snd_ice1712_get_gpio_mask(struct snd_ice1712 *ice)
{}

static void snd_ice1712_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data)
{}

static unsigned int snd_ice1712_get_gpio_data(struct snd_ice1712 *ice)
{}

static void snd_ice1712_set_gpio_data(struct snd_ice1712 *ice, unsigned int val)
{}

/*
 *
 * CS8427 interface
 *
 */

/*
 * change the input clock selection
 * spdif_clock = 1 - IEC958 input, 0 - Envy24
 */
static int snd_ice1712_cs8427_set_input_clock(struct snd_ice1712 *ice, int spdif_clock)
{}

/*
 * spdif callbacks
 */
static void open_cs8427(struct snd_ice1712 *ice, struct snd_pcm_substream *substream)
{}

static void close_cs8427(struct snd_ice1712 *ice, struct snd_pcm_substream *substream)
{}

static void setup_cs8427(struct snd_ice1712 *ice, int rate)
{}

/*
 * create and initialize callbacks for cs8427 interface
 */
int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr)
{}

static void snd_ice1712_set_input_clock_source(struct snd_ice1712 *ice, int spdif_is_master)
{}

/*
 *  Interrupt handler
 */

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


/*
 *  PCM part - consumer I/O
 */

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

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

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

static int snd_ice1712_playback_prepare(struct snd_pcm_substream *substream)
{}

static int snd_ice1712_playback_ds_prepare(struct snd_pcm_substream *substream)
{}

static int snd_ice1712_capture_prepare(struct snd_pcm_substream *substream)
{}

static snd_pcm_uframes_t snd_ice1712_playback_pointer(struct snd_pcm_substream *substream)
{}

static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substream *substream)
{}

static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_hardware snd_ice1712_playback =;

static const struct snd_pcm_hardware snd_ice1712_playback_ds =;

static const struct snd_pcm_hardware snd_ice1712_capture =;

static int snd_ice1712_playback_open(struct snd_pcm_substream *substream)
{}

static int snd_ice1712_playback_ds_open(struct snd_pcm_substream *substream)
{}

static int snd_ice1712_capture_open(struct snd_pcm_substream *substream)
{}

static int snd_ice1712_playback_close(struct snd_pcm_substream *substream)
{}

static int snd_ice1712_playback_ds_close(struct snd_pcm_substream *substream)
{}

static int snd_ice1712_capture_close(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_ops snd_ice1712_playback_ops =;

static const struct snd_pcm_ops snd_ice1712_playback_ds_ops =;

static const struct snd_pcm_ops snd_ice1712_capture_ops =;

static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device)
{}

static int snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device)
{}

/*
 *  PCM code - professional part (multitrack)
 */

static const unsigned int rates[] =;

static const struct snd_pcm_hw_constraint_list hw_constraints_rates =;

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

/*
 */
static void snd_ice1712_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, int force)
{}

static int snd_ice1712_playback_pro_prepare(struct snd_pcm_substream *substream)
{}

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

static int snd_ice1712_capture_pro_prepare(struct snd_pcm_substream *substream)
{}

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

static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(struct snd_pcm_substream *substream)
{}

static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_hardware snd_ice1712_playback_pro =;

static const struct snd_pcm_hardware snd_ice1712_capture_pro =;

static int snd_ice1712_playback_pro_open(struct snd_pcm_substream *substream)
{}

static int snd_ice1712_capture_pro_open(struct snd_pcm_substream *substream)
{}

static int snd_ice1712_playback_pro_close(struct snd_pcm_substream *substream)
{}

static int snd_ice1712_capture_pro_close(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_ops snd_ice1712_playback_pro_ops =;

static const struct snd_pcm_ops snd_ice1712_capture_pro_ops =;

static int snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device)
{}

/*
 *  Mixer section
 */

static void snd_ice1712_update_volume(struct snd_ice1712 *ice, int index)
{}

#define snd_ice1712_pro_mixer_switch_info

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

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

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

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

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

static const DECLARE_TLV_DB_SCALE(db_scale_playback, -14400, 150, 0);

static const struct snd_kcontrol_new snd_ice1712_multi_playback_ctrls[] =;

static const struct snd_kcontrol_new snd_ice1712_multi_capture_analog_switch =;

static const struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_switch =;

static const struct snd_kcontrol_new snd_ice1712_multi_capture_analog_volume =;

static const struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_volume =;

static int snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice)
{}

static void snd_ice1712_mixer_free_ac97(struct snd_ac97 *ac97)
{}

static int snd_ice1712_ac97_mixer(struct snd_ice1712 *ice)
{}

/*
 *
 */

static inline unsigned int eeprom_double(struct snd_ice1712 *ice, int idx)
{}

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

static void snd_ice1712_proc_init(struct snd_ice1712 *ice)
{}

/*
 *
 */

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

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

static const struct snd_kcontrol_new snd_ice1712_eeprom =;

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

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

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

static const struct snd_kcontrol_new snd_ice1712_spdif_default =;

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

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

static const struct snd_kcontrol_new snd_ice1712_spdif_maskc =;

static const struct snd_kcontrol_new snd_ice1712_spdif_maskp =;

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

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

static const struct snd_kcontrol_new snd_ice1712_spdif_stream =;

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

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

/*
 *  rate
 */
static int snd_ice1712_pro_internal_clock_info(struct snd_kcontrol *kcontrol,
					       struct snd_ctl_elem_info *uinfo)
{}

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

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

static const struct snd_kcontrol_new snd_ice1712_pro_internal_clock =;

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

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

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

static const struct snd_kcontrol_new snd_ice1712_pro_internal_clock_default =;

#define snd_ice1712_pro_rate_locking_info

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

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

static const struct snd_kcontrol_new snd_ice1712_pro_rate_locking =;

#define snd_ice1712_pro_rate_reset_info

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

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

static const struct snd_kcontrol_new snd_ice1712_pro_rate_reset =;

/*
 * routing
 */
static int snd_ice1712_pro_route_info(struct snd_kcontrol *kcontrol,
				      struct snd_ctl_elem_info *uinfo)
{}

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

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

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

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

static const struct snd_kcontrol_new snd_ice1712_mixer_pro_analog_route =;

static const struct snd_kcontrol_new snd_ice1712_mixer_pro_spdif_route =;


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

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

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

static const struct snd_kcontrol_new snd_ice1712_mixer_pro_volume_rate =;

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

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

static const struct snd_kcontrol_new snd_ice1712_mixer_pro_peak =;

/*
 *
 */

/*
 * list of available boards
 */
static const struct snd_ice1712_card_info *card_tables[] =;

static unsigned char snd_ice1712_read_i2c(struct snd_ice1712 *ice,
					  unsigned char dev,
					  unsigned char addr)
{}

static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
				   const char *modelname)
{}



static int snd_ice1712_chip_init(struct snd_ice1712 *ice)
{}

int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice)
{}


static int snd_ice1712_build_controls(struct snd_ice1712 *ice)
{}

static void snd_ice1712_free(struct snd_card *card)
{}

static int snd_ice1712_create(struct snd_card *card,
			      struct pci_dev *pci,
			      const char *modelname,
			      int omni,
			      int cs8427_timeout,
			      int dxr_enable)
{}


/*
 *
 * Registration
 *
 */

static struct snd_ice1712_card_info no_matched;

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

#ifdef CONFIG_PM_SLEEP
static int snd_ice1712_suspend(struct device *dev)
{}

static int snd_ice1712_resume(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(snd_ice1712_pm, snd_ice1712_suspend, snd_ice1712_resume);
#define SND_VT1712_PM_OPS
#else
#define SND_VT1712_PM_OPS
#endif /* CONFIG_PM_SLEEP */

static struct pci_driver ice1712_driver =;

module_pci_driver();