linux/sound/drivers/dummy.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Dummy soundcard
 *  Copyright (c) by Jaroslav Kysela <[email protected]>
 */

#include <linux/init.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/jiffies.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/wait.h>
#include <linux/hrtimer.h>
#include <linux/math64.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/tlv.h>
#include <sound/pcm.h>
#include <sound/rawmidi.h>
#include <sound/info.h>
#include <sound/initval.h>

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

#define MAX_PCM_DEVICES
#define MAX_PCM_SUBSTREAMS
#define MAX_MIDI_DEVICES

/* defaults */
#define MAX_BUFFER_SIZE
#define MIN_PERIOD_SIZE
#define MAX_PERIOD_SIZE
#define USE_FORMATS
#define USE_RATE
#define USE_RATE_MIN
#define USE_RATE_MAX
#define USE_CHANNELS_MIN
#define USE_CHANNELS_MAX
#define USE_PERIODS_MIN
#define USE_PERIODS_MAX
#define USE_MIXER_VOLUME_LEVEL_MIN
#define USE_MIXER_VOLUME_LEVEL_MAX

static int index[SNDRV_CARDS] =;	/* Index 0-MAX */
static char *id[SNDRV_CARDS] =;	/* ID for this card */
static bool enable[SNDRV_CARDS] =;
static char *model[SNDRV_CARDS] =;
static int pcm_devs[SNDRV_CARDS] =;
static int pcm_substreams[SNDRV_CARDS] =;
//static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
static int mixer_volume_level_min =;
static int mixer_volume_level_max =;
#ifdef CONFIG_HIGH_RES_TIMERS
static bool hrtimer =;
#endif
static bool fake_buffer =;

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(midi_devs, int, NULL, 0444);
//MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for dummy driver.");
module_param(mixer_volume_level_min, int, 0444);
MODULE_PARM_DESC();
module_param(mixer_volume_level_max, int, 0444);
MODULE_PARM_DESC();
module_param(fake_buffer, bool, 0444);
MODULE_PARM_DESC();
#ifdef CONFIG_HIGH_RES_TIMERS
module_param(hrtimer, bool, 0644);
MODULE_PARM_DESC();
#endif

static struct platform_device *devices[SNDRV_CARDS];

#define MIXER_ADDR_MASTER
#define MIXER_ADDR_LINE
#define MIXER_ADDR_MIC
#define MIXER_ADDR_SYNTH
#define MIXER_ADDR_CD
#define MIXER_ADDR_LAST

struct dummy_timer_ops {};

#define get_dummy_ops(substream)

struct dummy_model {};

struct snd_dummy {};

/*
 * card models
 */

static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime)
{}

static const struct dummy_model model_emu10k1 =;

static const struct dummy_model model_rme9652 =;

static const struct dummy_model model_ice1712 =;

static const struct dummy_model model_uda1341 =;

static const struct dummy_model model_ac97 =;

static const struct dummy_model model_ca0106 =;

static const struct dummy_model *dummy_models[] =;

/*
 * system timer interface
 */

struct dummy_systimer_pcm {};

static void dummy_systimer_rearm(struct dummy_systimer_pcm *dpcm)
{}

static void dummy_systimer_update(struct dummy_systimer_pcm *dpcm)
{}

static int dummy_systimer_start(struct snd_pcm_substream *substream)
{}

static int dummy_systimer_stop(struct snd_pcm_substream *substream)
{}

static int dummy_systimer_prepare(struct snd_pcm_substream *substream)
{}

static void dummy_systimer_callback(struct timer_list *t)
{}

static snd_pcm_uframes_t
dummy_systimer_pointer(struct snd_pcm_substream *substream)
{}

static int dummy_systimer_create(struct snd_pcm_substream *substream)
{}

static void dummy_systimer_free(struct snd_pcm_substream *substream)
{}

static const struct dummy_timer_ops dummy_systimer_ops =;

#ifdef CONFIG_HIGH_RES_TIMERS
/*
 * hrtimer interface
 */

struct dummy_hrtimer_pcm {};

static enum hrtimer_restart dummy_hrtimer_callback(struct hrtimer *timer)
{}

static int dummy_hrtimer_start(struct snd_pcm_substream *substream)
{}

static int dummy_hrtimer_stop(struct snd_pcm_substream *substream)
{}

static inline void dummy_hrtimer_sync(struct dummy_hrtimer_pcm *dpcm)
{}

static snd_pcm_uframes_t
dummy_hrtimer_pointer(struct snd_pcm_substream *substream)
{}

static int dummy_hrtimer_prepare(struct snd_pcm_substream *substream)
{}

static int dummy_hrtimer_create(struct snd_pcm_substream *substream)
{}

static void dummy_hrtimer_free(struct snd_pcm_substream *substream)
{}

static const struct dummy_timer_ops dummy_hrtimer_ops =;

#endif /* CONFIG_HIGH_RES_TIMERS */

/*
 * PCM interface
 */

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

static int dummy_pcm_prepare(struct snd_pcm_substream *substream)
{}

static snd_pcm_uframes_t dummy_pcm_pointer(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_hardware dummy_pcm_hardware =;

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

static int dummy_pcm_open(struct snd_pcm_substream *substream)
{}

static int dummy_pcm_close(struct snd_pcm_substream *substream)
{}

/*
 * dummy buffer handling
 */

static void *dummy_page[2];

static void free_fake_buffer(void)
{}

static int alloc_fake_buffer(void)
{}

static int dummy_pcm_copy(struct snd_pcm_substream *substream,
			  int channel, unsigned long pos,
			  struct iov_iter *iter, unsigned long bytes)
{}

static int dummy_pcm_silence(struct snd_pcm_substream *substream,
			     int channel, unsigned long pos,
			     unsigned long bytes)
{}

static struct page *dummy_pcm_page(struct snd_pcm_substream *substream,
				   unsigned long offset)
{}

static const struct snd_pcm_ops dummy_pcm_ops =;

static const struct snd_pcm_ops dummy_pcm_ops_no_buf =;

static int snd_card_dummy_pcm(struct snd_dummy *dummy, int device,
			      int substreams)
{}

/*
 * mixer interface
 */

#define DUMMY_VOLUME(xname, xindex, addr)

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

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

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

static const DECLARE_TLV_DB_SCALE(db_scale_dummy, -4500, 30, 0);

#define DUMMY_CAPSRC(xname, xindex, addr)

#define snd_dummy_capsrc_info

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

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

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

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

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

static const struct snd_kcontrol_new snd_dummy_controls[] =;

static int snd_card_dummy_new_mixer(struct snd_dummy *dummy)
{}

#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_PROC_FS)
/*
 * proc interface
 */
static void print_formats(struct snd_dummy *dummy,
			  struct snd_info_buffer *buffer)
{}

static void print_rates(struct snd_dummy *dummy,
			struct snd_info_buffer *buffer)
{}

#define get_dummy_int_ptr(dummy, ofs)
#define get_dummy_ll_ptr(dummy, ofs)

struct dummy_hw_field {};
#define FIELD_ENTRY(item, fmt)

static const struct dummy_hw_field fields[] =;

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

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

static void dummy_proc_init(struct snd_dummy *chip)
{}
#else
#define dummy_proc_init
#endif /* CONFIG_SND_DEBUG && CONFIG_SND_PROC_FS */

static int snd_dummy_probe(struct platform_device *devptr)
{}

static int snd_dummy_suspend(struct device *pdev)
{}

static int snd_dummy_resume(struct device *pdev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(snd_dummy_pm, snd_dummy_suspend, snd_dummy_resume);

#define SND_DUMMY_DRIVER

static struct platform_driver snd_dummy_driver =;

static void snd_dummy_unregister_all(void)
{}

static int __init alsa_card_dummy_init(void)
{}

static void __exit alsa_card_dummy_exit(void)
{}

module_init()
module_exit()