// SPDX-License-Identifier: GPL-2.0+ /* * u_uac1.c -- ALSA audio utilities for Gadget stack * * Copyright (C) 2008 Bryan Wu <[email protected]> * Copyright (C) 2008 Analog Devices, Inc */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/device.h> #include <linux/delay.h> #include <linux/ctype.h> #include <linux/random.h> #include <linux/syscalls.h> #include "u_uac1_legacy.h" /* * This component encapsulates the ALSA devices for USB audio gadget */ /*-------------------------------------------------------------------------*/ /* * Some ALSA internal helper functions */ static int snd_interval_refine_set(struct snd_interval *i, unsigned int val) { … } static int _snd_pcm_hw_param_set(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, unsigned int val, int dir) { … } /*-------------------------------------------------------------------------*/ /* * Set default hardware params */ static int playback_default_hw_params(struct gaudio_snd_dev *snd) { … } /* * Playback audio buffer data by ALSA PCM device */ size_t u_audio_playback(struct gaudio *card, void *buf, size_t count) { … } int u_audio_get_playback_channels(struct gaudio *card) { … } int u_audio_get_playback_rate(struct gaudio *card) { … } /* * Open ALSA PCM and control device files * Initial the PCM or control device */ static int gaudio_open_snd_dev(struct gaudio *card) { … } /* * Close ALSA PCM and control device files */ static int gaudio_close_snd_dev(struct gaudio *gau) { … } /* * gaudio_setup - setup ALSA interface and preparing for USB transfer * * This sets up PCM, mixer or MIDI ALSA devices fore USB gadget using. * * Returns negative errno, or zero on success */ int gaudio_setup(struct gaudio *card) { … } /* * gaudio_cleanup - remove ALSA device interface * * This is called to free all resources allocated by @gaudio_setup(). */ void gaudio_cleanup(struct gaudio *the_card) { … }