linux/sound/pci/fm801.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  The driver for the ForteMedia FM801 based soundcards
 *  Copyright (c) by Jaroslav Kysela <[email protected]>
 */

#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/tlv.h>
#include <sound/ac97_codec.h>
#include <sound/mpu401.h>
#include <sound/opl3.h>
#include <sound/initval.h>

#ifdef CONFIG_SND_FM801_TEA575X_BOOL
#include <media/drv-intf/tea575x.h>
#endif

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 */
/*
 *  Enable TEA575x tuner
 *    1 = MediaForte 256-PCS
 *    2 = MediaForte 256-PCP
 *    3 = MediaForte 64-PCR
 *   16 = setup tuner only (this is additional bit), i.e. SF64-PCR FM card
 *  High 16-bits are video (radio) device number + 1
 */
static int tea575x_tuner[SNDRV_CARDS];
static int radio_nr[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();
module_param_array();
MODULE_PARM_DESC();


#define TUNER_DISABLED
#define TUNER_ONLY
#define TUNER_TYPE_MASK

/*
 *  Direct registers
 */

#define fm801_writew(chip,reg,value)
#define fm801_readw(chip,reg)

#define fm801_writel(chip,reg,value)

#define FM801_PCM_VOL
#define FM801_FM_VOL
#define FM801_I2S_VOL
#define FM801_REC_SRC
#define FM801_PLY_CTRL
#define FM801_PLY_COUNT
#define FM801_PLY_BUF1
#define FM801_PLY_BUF2
#define FM801_CAP_CTRL
#define FM801_CAP_COUNT
#define FM801_CAP_BUF1
#define FM801_CAP_BUF2
#define FM801_CODEC_CTRL
#define FM801_I2S_MODE
#define FM801_VOLUME
#define FM801_I2C_CTRL
#define FM801_AC97_CMD
#define FM801_AC97_DATA
#define FM801_MPU401_DATA
#define FM801_MPU401_CMD
#define FM801_GPIO_CTRL
#define FM801_GEN_CTRL
#define FM801_IRQ_MASK
#define FM801_IRQ_STATUS
#define FM801_OPL3_BANK0
#define FM801_OPL3_DATA0
#define FM801_OPL3_BANK1
#define FM801_OPL3_DATA1
#define FM801_POWERDOWN

/* codec access */
#define FM801_AC97_READ
#define FM801_AC97_VALID
#define FM801_AC97_BUSY
#define FM801_AC97_ADDR_SHIFT

/* playback and record control register bits */
#define FM801_BUF1_LAST
#define FM801_BUF2_LAST
#define FM801_START
#define FM801_PAUSE
#define FM801_IMMED_STOP
#define FM801_RATE_SHIFT
#define FM801_RATE_MASK
#define FM801_CHANNELS_4
#define FM801_CHANNELS_6
#define FM801_CHANNELS_6MS
#define FM801_CHANNELS_MASK
#define FM801_16BIT
#define FM801_STEREO

/* IRQ status bits */
#define FM801_IRQ_PLAYBACK
#define FM801_IRQ_CAPTURE
#define FM801_IRQ_VOLUME
#define FM801_IRQ_MPU

/* GPIO control register */
#define FM801_GPIO_GP0
#define FM801_GPIO_GP1
#define FM801_GPIO_GP2
#define FM801_GPIO_GP3
#define FM801_GPIO_GP(x)
#define FM801_GPIO_GD0
#define FM801_GPIO_GD1
#define FM801_GPIO_GD2
#define FM801_GPIO_GD3
#define FM801_GPIO_GD(x)
#define FM801_GPIO_GS0
#define FM801_GPIO_GS1
#define FM801_GPIO_GS2
#define FM801_GPIO_GS3
#define FM801_GPIO_GS(x)
	
/**
 * struct fm801 - describes FM801 chip
 * @dev:		device for this chio
 * @irq:		irq number
 * @port:		I/O port number
 * @multichannel:	multichannel support
 * @secondary:		secondary codec
 * @secondary_addr:	address of the secondary codec
 * @tea575x_tuner:	tuner access method & flags
 * @ply_ctrl:		playback control
 * @cap_ctrl:		capture control
 * @ply_buffer:		playback buffer
 * @ply_buf:		playback buffer index
 * @ply_count:		playback buffer count
 * @ply_size:		playback buffer size
 * @ply_pos:		playback position
 * @cap_buffer:		capture buffer
 * @cap_buf:		capture buffer index
 * @cap_count:		capture buffer count
 * @cap_size:		capture buffer size
 * @cap_pos:		capture position
 * @ac97_bus:		ac97 bus handle
 * @ac97:		ac97 handle
 * @ac97_sec:		ac97 secondary handle
 * @card:		ALSA card
 * @pcm:		PCM devices
 * @rmidi:		rmidi device
 * @playback_substream:	substream for playback
 * @capture_substream:	substream for capture
 * @p_dma_size:		playback DMA size
 * @c_dma_size:		capture DMA size
 * @reg_lock:		lock
 * @proc_entry:		/proc entry
 * @v4l2_dev:		v4l2 device
 * @tea:		tea575a structure
 * @saved_regs:		context saved during suspend
 */
struct fm801 {};

/*
 * IO accessors
 */

static inline void fm801_iowrite16(struct fm801 *chip, unsigned short offset, u16 value)
{}

static inline u16 fm801_ioread16(struct fm801 *chip, unsigned short offset)
{}

static const struct pci_device_id snd_fm801_ids[] =;

MODULE_DEVICE_TABLE(pci, snd_fm801_ids);

/*
 *  common I/O routines
 */

static bool fm801_ac97_is_ready(struct fm801 *chip, unsigned int iterations)
{}

static bool fm801_ac97_is_valid(struct fm801 *chip, unsigned int iterations)
{}

static int snd_fm801_update_bits(struct fm801 *chip, unsigned short reg,
				 unsigned short mask, unsigned short value)
{}

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

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

static const unsigned int rates[] =;

static const struct snd_pcm_hw_constraint_list hw_constraints_rates =;

static const unsigned int channels[] =;

static const struct snd_pcm_hw_constraint_list hw_constraints_channels =;

/*
 *  Sample rate routines
 */

static unsigned short snd_fm801_rate_bits(unsigned int rate)
{}

/*
 *  PCM part
 */

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

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

static int snd_fm801_playback_prepare(struct snd_pcm_substream *substream)
{}

static int snd_fm801_capture_prepare(struct snd_pcm_substream *substream)
{}

static snd_pcm_uframes_t snd_fm801_playback_pointer(struct snd_pcm_substream *substream)
{}

static snd_pcm_uframes_t snd_fm801_capture_pointer(struct snd_pcm_substream *substream)
{}

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

static const struct snd_pcm_hardware snd_fm801_playback =;

static const struct snd_pcm_hardware snd_fm801_capture =;

static int snd_fm801_playback_open(struct snd_pcm_substream *substream)
{}

static int snd_fm801_capture_open(struct snd_pcm_substream *substream)
{}

static int snd_fm801_playback_close(struct snd_pcm_substream *substream)
{}

static int snd_fm801_capture_close(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_ops snd_fm801_playback_ops =;

static const struct snd_pcm_ops snd_fm801_capture_ops =;

static int snd_fm801_pcm(struct fm801 *chip, int device)
{}

/*
 *  TEA5757 radio
 */

#ifdef CONFIG_SND_FM801_TEA575X_BOOL

/* GPIO to TEA575x maps */
struct snd_fm801_tea575x_gpio {};

static const struct snd_fm801_tea575x_gpio snd_fm801_tea575x_gpios[] =;

#define get_tea575x_gpio(chip)

static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins)
{}

static u8 snd_fm801_tea575x_get_pins(struct snd_tea575x *tea)
{}

static void snd_fm801_tea575x_set_direction(struct snd_tea575x *tea, bool output)
{}

static const struct snd_tea575x_ops snd_fm801_tea_ops =;
#endif

/*
 *  Mixer routines
 */

#define FM801_SINGLE(xname, reg, shift, mask, invert)

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

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

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

#define FM801_DOUBLE(xname, reg, shift_left, shift_right, mask, invert)
#define FM801_DOUBLE_TLV(xname, reg, shift_left, shift_right, mask, invert, xtlv)

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

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

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

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

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

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

static const DECLARE_TLV_DB_SCALE(db_scale_dsp, -3450, 150, 0);

#define FM801_CONTROLS

static const struct snd_kcontrol_new snd_fm801_controls[] =;

#define FM801_CONTROLS_MULTI

static const struct snd_kcontrol_new snd_fm801_controls_multi[] =;

static int snd_fm801_mixer(struct fm801 *chip)
{}

/*
 *  initialization routines
 */

static int wait_for_codec(struct fm801 *chip, unsigned int codec_id,
			  unsigned short reg, unsigned long waits)
{}

static int reset_codec(struct fm801 *chip)
{}

static void snd_fm801_chip_multichannel_init(struct fm801 *chip)
{}

static void snd_fm801_chip_init(struct fm801 *chip)
{}

static void snd_fm801_free(struct snd_card *card)
{}

static int snd_fm801_create(struct snd_card *card,
			    struct pci_dev *pci,
			    int tea575x_tuner,
			    int radio_nr)
{}

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

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

static const unsigned char saved_regs[] =;

static int snd_fm801_suspend(struct device *dev)
{}

static int snd_fm801_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(snd_fm801_pm, snd_fm801_suspend, snd_fm801_resume);

static struct pci_driver fm801_driver =;

module_pci_driver();