mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 15:41:36 +00:00
24ceb9c669
Now that the SPDX tag is in all USB files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Oliver Neukum <oneukum@suse.com> Cc: Johan Hovold <johan@kernel.org> Cc: Jerry Zhang <zhangjerry@google.com> Cc: John Keeping <john@metanate.com> Cc: Krzysztof Opasiak <k.opasiak@samsung.com> Cc: Abdulhadi Mohamed <abdulahhadi2@gmail.com> Cc: Matthew Wilcox <willy@linux.intel.com> Cc: Janusz Dziedzic <januszx.dziedzic@linux.intel.com> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Vincent Pelletier <plr.vincent@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
86 lines
2.0 KiB
C
86 lines
2.0 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* u_audio.h -- interface to USB gadget "ALSA sound card" utilities
|
|
*
|
|
* Copyright (C) 2016
|
|
* Author: Ruslan Bilovol <ruslan.bilovol@gmail.com>
|
|
*/
|
|
|
|
#ifndef __U_AUDIO_H
|
|
#define __U_AUDIO_H
|
|
|
|
#include <linux/usb/composite.h>
|
|
|
|
struct uac_params {
|
|
/* playback */
|
|
int p_chmask; /* channel mask */
|
|
int p_srate; /* rate in Hz */
|
|
int p_ssize; /* sample size */
|
|
|
|
/* capture */
|
|
int c_chmask; /* channel mask */
|
|
int c_srate; /* rate in Hz */
|
|
int c_ssize; /* sample size */
|
|
|
|
int req_number; /* number of preallocated requests */
|
|
};
|
|
|
|
struct g_audio {
|
|
struct usb_function func;
|
|
struct usb_gadget *gadget;
|
|
|
|
struct usb_ep *in_ep;
|
|
struct usb_ep *out_ep;
|
|
|
|
/* Max packet size for all in_ep possible speeds */
|
|
unsigned int in_ep_maxpsize;
|
|
/* Max packet size for all out_ep possible speeds */
|
|
unsigned int out_ep_maxpsize;
|
|
|
|
/* The ALSA Sound Card it represents on the USB-Client side */
|
|
struct snd_uac_chip *uac;
|
|
|
|
struct uac_params params;
|
|
};
|
|
|
|
static inline struct g_audio *func_to_g_audio(struct usb_function *f)
|
|
{
|
|
return container_of(f, struct g_audio, func);
|
|
}
|
|
|
|
static inline uint num_channels(uint chanmask)
|
|
{
|
|
uint num = 0;
|
|
|
|
while (chanmask) {
|
|
num += (chanmask & 1);
|
|
chanmask >>= 1;
|
|
}
|
|
|
|
return num;
|
|
}
|
|
|
|
/*
|
|
* g_audio_setup - initialize one virtual ALSA sound card
|
|
* @g_audio: struct with filled params, in_ep_maxpsize, out_ep_maxpsize
|
|
* @pcm_name: the id string for a PCM instance of this sound card
|
|
* @card_name: name of this soundcard
|
|
*
|
|
* This sets up the single virtual ALSA sound card that may be exported by a
|
|
* gadget driver using this framework.
|
|
*
|
|
* Context: may sleep
|
|
*
|
|
* Returns zero on success, or a negative error on failure.
|
|
*/
|
|
int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
|
|
const char *card_name);
|
|
void g_audio_cleanup(struct g_audio *g_audio);
|
|
|
|
int u_audio_start_capture(struct g_audio *g_audio);
|
|
void u_audio_stop_capture(struct g_audio *g_audio);
|
|
int u_audio_start_playback(struct g_audio *g_audio);
|
|
void u_audio_stop_playback(struct g_audio *g_audio);
|
|
|
|
#endif /* __U_AUDIO_H */
|