linux/sound/pci/ymfpci/ymfpci_main.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Copyright (c) by Jaroslav Kysela <[email protected]>
 *  Routines for control of YMF724/740/744/754 chips
 */

#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/module.h>
#include <linux/io.h>

#include <sound/core.h>
#include <sound/control.h>
#include <sound/info.h>
#include <sound/tlv.h>
#include "ymfpci.h"
#include <sound/asoundef.h>
#include <sound/mpu401.h>

#include <asm/byteorder.h>

/*
 *  common I/O routines
 */

static void snd_ymfpci_irq_wait(struct snd_ymfpci *chip);

static inline void snd_ymfpci_writeb(struct snd_ymfpci *chip, u32 offset, u8 val)
{}

static inline u16 snd_ymfpci_readw(struct snd_ymfpci *chip, u32 offset)
{}

static inline void snd_ymfpci_writew(struct snd_ymfpci *chip, u32 offset, u16 val)
{}

static inline u32 snd_ymfpci_readl(struct snd_ymfpci *chip, u32 offset)
{}

static inline void snd_ymfpci_writel(struct snd_ymfpci *chip, u32 offset, u32 val)
{}

static int snd_ymfpci_codec_ready(struct snd_ymfpci *chip, int secondary)
{}

static void snd_ymfpci_codec_write(struct snd_ac97 *ac97, u16 reg, u16 val)
{}

static u16 snd_ymfpci_codec_read(struct snd_ac97 *ac97, u16 reg)
{}

/*
 *  Misc routines
 */

static u32 snd_ymfpci_calc_delta(u32 rate)
{}

static const u32 def_rate[8] =;

static u32 snd_ymfpci_calc_lpfK(u32 rate)
{}

static u32 snd_ymfpci_calc_lpfQ(u32 rate)
{}

/*
 *  Hardware start management
 */

static void snd_ymfpci_hw_start(struct snd_ymfpci *chip)
{}

static void snd_ymfpci_hw_stop(struct snd_ymfpci *chip)
{}

/*
 *  Playback voice management
 */

static int voice_alloc(struct snd_ymfpci *chip,
		       enum snd_ymfpci_voice_type type, int pair,
		       struct snd_ymfpci_voice **rvoice)
{}

static int snd_ymfpci_voice_alloc(struct snd_ymfpci *chip,
				  enum snd_ymfpci_voice_type type, int pair,
				  struct snd_ymfpci_voice **rvoice)
{}

static int snd_ymfpci_voice_free(struct snd_ymfpci *chip, struct snd_ymfpci_voice *pvoice)
{}

/*
 *  PCM part
 */

static void snd_ymfpci_pcm_interrupt(struct snd_ymfpci *chip, struct snd_ymfpci_voice *voice)
{}

static void snd_ymfpci_pcm_capture_interrupt(struct snd_pcm_substream *substream)
{}

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

static int snd_ymfpci_pcm_voice_alloc(struct snd_ymfpci_pcm *ypcm, int voices)
{}

static void snd_ymfpci_pcm_init_voice(struct snd_ymfpci_pcm *ypcm, unsigned int voiceidx,
				      struct snd_pcm_runtime *runtime,
				      int has_pcm_volume)
{}

static int snd_ymfpci_ac3_init(struct snd_ymfpci *chip)
{}

static int snd_ymfpci_ac3_done(struct snd_ymfpci *chip)
{}

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

static int snd_ymfpci_playback_hw_free(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_playback_prepare(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_capture_hw_free(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_capture_prepare(struct snd_pcm_substream *substream)
{}

static snd_pcm_uframes_t snd_ymfpci_playback_pointer(struct snd_pcm_substream *substream)
{}

static snd_pcm_uframes_t snd_ymfpci_capture_pointer(struct snd_pcm_substream *substream)
{}

static void snd_ymfpci_irq_wait(struct snd_ymfpci *chip)
{}

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

static const struct snd_pcm_hardware snd_ymfpci_playback =;

static const struct snd_pcm_hardware snd_ymfpci_capture =;

static void snd_ymfpci_pcm_free_substream(struct snd_pcm_runtime *runtime)
{}

static int snd_ymfpci_playback_open_1(struct snd_pcm_substream *substream)
{}

/* call with spinlock held */
static void ymfpci_open_extension(struct snd_ymfpci *chip)
{}

/* call with spinlock held */
static void ymfpci_close_extension(struct snd_ymfpci *chip)
{}

static int snd_ymfpci_playback_open(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_playback_spdif_open(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_playback_4ch_open(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_capture_open(struct snd_pcm_substream *substream,
				   u32 capture_bank_number)
{}

static int snd_ymfpci_capture_rec_open(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_capture_ac97_open(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_playback_close_1(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_playback_close(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_playback_spdif_close(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_playback_4ch_close(struct snd_pcm_substream *substream)
{}

static int snd_ymfpci_capture_close(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_ops snd_ymfpci_playback_ops =;

static const struct snd_pcm_ops snd_ymfpci_capture_rec_ops =;

int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device)
{}

static const struct snd_pcm_ops snd_ymfpci_capture_ac97_ops =;

int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device)
{}

static const struct snd_pcm_ops snd_ymfpci_playback_spdif_ops =;

int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device)
{}

static const struct snd_pcm_ops snd_ymfpci_playback_4ch_ops =;

static const struct snd_pcm_chmap_elem surround_map[] =;

int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device)
{}

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

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

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

static const struct snd_kcontrol_new snd_ymfpci_spdif_default =;

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

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

static const struct snd_kcontrol_new snd_ymfpci_spdif_mask =;

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

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

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

static const struct snd_kcontrol_new snd_ymfpci_spdif_stream =;

static int snd_ymfpci_drec_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *info)
{}

static int snd_ymfpci_drec_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *value)
{}

static int snd_ymfpci_drec_source_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *value)
{}

static const struct snd_kcontrol_new snd_ymfpci_drec_source =;

/*
 *  Mixer controls
 */

#define YMFPCI_SINGLE(xname, xindex, reg, shift)

#define snd_ymfpci_info_single

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

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

static const DECLARE_TLV_DB_LINEAR(db_scale_native, TLV_DB_GAIN_MUTE, 0);

#define YMFPCI_DOUBLE(xname, xindex, reg)

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

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

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

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

/*
 * 4ch duplication
 */
#define snd_ymfpci_info_dup4ch

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

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

static const struct snd_kcontrol_new snd_ymfpci_dup4ch =;

static const struct snd_kcontrol_new snd_ymfpci_controls[] =;


/*
 * GPIO
 */

static int snd_ymfpci_get_gpio_out(struct snd_ymfpci *chip, int pin)
{}

static int snd_ymfpci_set_gpio_out(struct snd_ymfpci *chip, int pin, int enable)
{}

#define snd_ymfpci_gpio_sw_info

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

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

static const struct snd_kcontrol_new snd_ymfpci_rear_shared =;

/*
 * PCM voice volume
 */

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

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

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

static const struct snd_kcontrol_new snd_ymfpci_pcm_volume =;


/*
 *  Mixer routines
 */

static void snd_ymfpci_mixer_free_ac97_bus(struct snd_ac97_bus *bus)
{}

static void snd_ymfpci_mixer_free_ac97(struct snd_ac97 *ac97)
{}

int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch)
{}


/*
 * timer
 */

static int snd_ymfpci_timer_start(struct snd_timer *timer)
{}

static int snd_ymfpci_timer_stop(struct snd_timer *timer)
{}

static int snd_ymfpci_timer_precise_resolution(struct snd_timer *timer,
					       unsigned long *num, unsigned long *den)
{}

static const struct snd_timer_hardware snd_ymfpci_timer_hw =;

int snd_ymfpci_timer(struct snd_ymfpci *chip, int device)
{}


/*
 *  proc interface
 */

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

static int snd_ymfpci_proc_init(struct snd_card *card, struct snd_ymfpci *chip)
{}

/*
 *  initialization routines
 */

static void snd_ymfpci_aclink_reset(struct pci_dev * pci)
{}

static void snd_ymfpci_enable_dsp(struct snd_ymfpci *chip)
{}

static void snd_ymfpci_disable_dsp(struct snd_ymfpci *chip)
{}

static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
{}

MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();

static void snd_ymfpci_download_image(struct snd_ymfpci *chip)
{}

static int snd_ymfpci_memalloc(struct snd_ymfpci *chip)
{}

static void snd_ymfpci_free(struct snd_card *card)
{}

static int snd_ymfpci_suspend(struct device *dev)
{}

static int snd_ymfpci_resume(struct device *dev)
{}

DEFINE_SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume);

int snd_ymfpci_create(struct snd_card *card,
		      struct pci_dev *pci,
		      u16 old_legacy_ctrl)
{}