linux/sound/usb/usx2y/usbusx2yaudio.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *   US-X2Y AUDIO
 *   Copyright (c) 2002-2004 by Karsten Wiese
 *
 *   based on
 *
 *   (Tentative) USB Audio Driver for ALSA
 *
 *   Main and PCM part
 *
 *   Copyright (c) 2002 by Takashi Iwai <[email protected]>
 *
 *   Many codes borrowed from audio.c by
 *	    Alan Cox ([email protected])
 *	    Thomas Sailer ([email protected])
 */


#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/moduleparam.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include "usx2y.h"
#include "usbusx2y.h"

/* Default value used for nr of packs per urb.
 * 1 to 4 have been tested ok on uhci.
 * To use 3 on ohci, you'd need a patch:
 * look for "0000425-linux-2.6.9-rc4-mm1_ohci-hcd.patch.gz" on
 * "https://bugtrack.alsa-project.org/alsa-bug/bug_view_page.php?bug_id=0000425"
 *
 * 1, 2 and 4 work out of the box on ohci, if I recall correctly.
 * Bigger is safer operation, smaller gives lower latencies.
 */
#define USX2Y_NRPACKS

/* If your system works ok with this module's parameter
 * nrpacks set to 1, you might as well comment
 * this define out, and thereby produce smaller, faster code.
 * You'd also set USX2Y_NRPACKS to 1 then.
 */
#define USX2Y_NRPACKS_VARIABLE

#ifdef USX2Y_NRPACKS_VARIABLE
static int nrpacks =; /* number of packets per urb */
#define nr_of_packs()
module_param(nrpacks, int, 0444);
MODULE_PARM_DESC();
#else
#define nr_of_packs
#endif

static int usx2y_urb_capt_retire(struct snd_usx2y_substream *subs)
{}

/*
 * prepare urb for playback data pipe
 *
 * we copy the data directly from the pcm buffer.
 * the current position to be copied is held in hwptr field.
 * since a urb can handle only a single linear buffer, if the total
 * transferred area overflows the buffer boundary, we cannot send
 * it directly from the buffer.  thus the data is once copied to
 * a temporary buffer and urb points to that.
 */
static int usx2y_urb_play_prepare(struct snd_usx2y_substream *subs,
				  struct urb *cap_urb,
				  struct urb *urb)
{}

/*
 * process after playback data complete
 *
 * update the current position and call callback if a period is processed.
 */
static void usx2y_urb_play_retire(struct snd_usx2y_substream *subs, struct urb *urb)
{}

static int usx2y_urb_submit(struct snd_usx2y_substream *subs, struct urb *urb, int frame)
{}

static int usx2y_usbframe_complete(struct snd_usx2y_substream *capsubs,
				   struct snd_usx2y_substream *playbacksubs,
				   int frame)
{}

static void usx2y_clients_stop(struct usx2ydev *usx2y)
{}

static void usx2y_error_urb_status(struct usx2ydev *usx2y,
				   struct snd_usx2y_substream *subs, struct urb *urb)
{}

static void i_usx2y_urb_complete(struct urb *urb)
{}

static void usx2y_urbs_set_complete(struct usx2ydev *usx2y,
				    void (*complete)(struct urb *))
{}

static void usx2y_subs_startup_finish(struct usx2ydev *usx2y)
{}

static void i_usx2y_subs_startup(struct urb *urb)
{}

static void usx2y_subs_prepare(struct snd_usx2y_substream *subs)
{}

static void usx2y_urb_release(struct urb **urb, int free_tb)
{}

/*
 * release a substreams urbs
 */
static void usx2y_urbs_release(struct snd_usx2y_substream *subs)
{}

/*
 * initialize a substream's urbs
 */
static int usx2y_urbs_allocate(struct snd_usx2y_substream *subs)
{}

static void usx2y_subs_startup(struct snd_usx2y_substream *subs)
{}

static int usx2y_urbs_start(struct snd_usx2y_substream *subs)
{}

/*
 * return the current pcm pointer.  just return the hwptr_done value.
 */
static snd_pcm_uframes_t snd_usx2y_pcm_pointer(struct snd_pcm_substream *substream)
{}

/*
 * start/stop substream
 */
static int snd_usx2y_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{}

/*
 * allocate a buffer, setup samplerate
 *
 * so far we use a physically linear buffer although packetize transfer
 * doesn't need a continuous area.
 * if sg buffer is supported on the later version of alsa, we'll follow
 * that.
 */
struct s_c2 {};

static const struct s_c2 setrate_44100[] =;

static const struct s_c2 setrate_48000[] =;

#define NOOF_SETRATE_URBS

static void i_usx2y_04int(struct urb *urb)
{}

static int usx2y_rate_set(struct usx2ydev *usx2y, int rate)
{}

static int usx2y_format_set(struct usx2ydev *usx2y, snd_pcm_format_t format)
{}


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

/*
 * free the buffer
 */
static int snd_usx2y_pcm_hw_free(struct snd_pcm_substream *substream)
{}

/*
 * prepare callback
 *
 * set format and initialize urbs
 */
static int snd_usx2y_pcm_prepare(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_hardware snd_usx2y_2c =;

static int snd_usx2y_pcm_open(struct snd_pcm_substream *substream)
{}

static int snd_usx2y_pcm_close(struct snd_pcm_substream *substream)
{}

static const struct snd_pcm_ops snd_usx2y_pcm_ops =;

/*
 * free a usb stream instance
 */
static void usx2y_audio_stream_free(struct snd_usx2y_substream **usx2y_substream)
{}

static void snd_usx2y_pcm_private_free(struct snd_pcm *pcm)
{}

static int usx2y_audio_stream_new(struct snd_card *card, int playback_endpoint, int capture_endpoint)
{}

/*
 * create a chip instance and set its names.
 */
int usx2y_audio_create(struct snd_card *card)
{}