linux/drivers/media/pci/cx88/cx88-alsa.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Support for audio capture
 *  PCI function #1 of the cx2388x.
 *
 *    (c) 2007 Trent Piepho <[email protected]>
 *    (c) 2005,2006 Ricardo Cerqueira <[email protected]>
 *    (c) 2005 Mauro Carvalho Chehab <[email protected]>
 *    Based on a dummy cx88 module by Gerd Knorr <[email protected]>
 *    Based on dummy.c by Jaroslav Kysela <[email protected]>
 */

#include "cx88.h"
#include "cx88-reg.h"

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

#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/control.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <media/i2c/wm8775.h>

#define dprintk(level, fmt, arg...)

/*
 * Data type declarations - Can be moded to a header file later
 */

struct cx88_audio_buffer {};

struct cx88_audio_dev {};

/*
 * Module global static vars
 */

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

module_param_array();
MODULE_PARM_DESC();

module_param_array();
MODULE_PARM_DESC();

/*
 * Module macros
 */

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

static unsigned int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC();

/*
 * Module specific functions
 */

/*
 * BOARD Specific: Sets audio DMA
 */

static int _cx88_start_audio_dma(struct cx88_audio_dev *chip)
{}

/*
 * BOARD Specific: Resets audio DMA
 */
static int _cx88_stop_audio_dma(struct cx88_audio_dev *chip)
{}

#define MAX_IRQ_LOOP

/*
 * BOARD Specific: IRQ dma bits
 */
static const char *cx88_aud_irqs[32] =;

/*
 * BOARD Specific: Threats IRQ audio specific calls
 */
static void cx8801_aud_irq(struct cx88_audio_dev *chip)
{}

/*
 * BOARD Specific: Handles IRQ calls
 */
static irqreturn_t cx8801_irq(int irq, void *dev_id)
{}

static int cx88_alsa_dma_init(struct cx88_audio_dev *chip,
			      unsigned long nr_pages)
{}

static int cx88_alsa_dma_map(struct cx88_audio_dev *dev)
{}

static int cx88_alsa_dma_unmap(struct cx88_audio_dev *dev)
{}

static int cx88_alsa_dma_free(struct cx88_audio_buffer *buf)
{}

static int dsp_buffer_free(struct cx88_audio_dev *chip)
{}

/*
 * ALSA PCM Interface
 */

/*
 * Digital hardware definition
 */
#define DEFAULT_FIFO_SIZE
static const struct snd_pcm_hardware snd_cx88_digital_hw =;

/*
 * audio pcm capture open callback
 */
static int snd_cx88_pcm_open(struct snd_pcm_substream *substream)
{}

/*
 * audio close callback
 */
static int snd_cx88_close(struct snd_pcm_substream *substream)
{}

/*
 * hw_params callback
 */
static int snd_cx88_hw_params(struct snd_pcm_substream *substream,
			      struct snd_pcm_hw_params *hw_params)
{}

/*
 * hw free callback
 */
static int snd_cx88_hw_free(struct snd_pcm_substream *substream)
{}

/*
 * prepare callback
 */
static int snd_cx88_prepare(struct snd_pcm_substream *substream)
{}

/*
 * trigger callback
 */
static int snd_cx88_card_trigger(struct snd_pcm_substream *substream, int cmd)
{}

/*
 * pointer callback
 */
static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream)
{}

/*
 * page callback (needed for mmap)
 */
static struct page *snd_cx88_page(struct snd_pcm_substream *substream,
				  unsigned long offset)
{}

/*
 * operators
 */
static const struct snd_pcm_ops snd_cx88_pcm_ops =;

/*
 * create a PCM device
 */
static int snd_cx88_pcm(struct cx88_audio_dev *chip, int device,
			const char *name)
{}

/*
 * CONTROL INTERFACE
 */
static int snd_cx88_volume_info(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_info *info)
{}

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

static void snd_cx88_wm8775_volume_put(struct snd_kcontrol *kcontrol,
				       struct snd_ctl_elem_value *value)
{}

/* OK - TODO: test it */
static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
			       struct snd_ctl_elem_value *value)
{}

static const DECLARE_TLV_DB_SCALE(snd_cx88_db_scale, -6300, 100, 0);

static const struct snd_kcontrol_new snd_cx88_volume =;

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

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

static const struct snd_kcontrol_new snd_cx88_dac_switch =;

static const struct snd_kcontrol_new snd_cx88_source_switch =;

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

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

static const struct snd_kcontrol_new snd_cx88_alc_switch =;

/*
 * Basic Flow for Sound Devices
 */

/*
 * PCI ID Table - 14f1:8801 and 14f1:8811 means function 1: Audio
 * Only boards with eeprom and byte 1 at eeprom=1 have it
 */

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

/*
 * Chip-specific destructor
 */

static int snd_cx88_free(struct cx88_audio_dev *chip)
{}

/*
 * Component Destructor
 */
static void snd_cx88_dev_free(struct snd_card *card)
{}

/*
 * Alsa Constructor - Component probe
 */

static int devno;
static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci,
			   struct cx88_audio_dev **rchip,
			   struct cx88_core **core_ptr)
{}

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

/*
 * ALSA destructor
 */
static void cx88_audio_finidev(struct pci_dev *pci)
{}

/*
 * PCI driver definition
 */

static struct pci_driver cx88_audio_pci_driver =;

module_pci_driver();