Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / usb / gadget / function / u_uac1_legacy.h
blobdd69e408a3d9a9676ef204c2557b257299707794
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * u_uac1.h -- interface to USB gadget "ALSA AUDIO" utilities
5 * Copyright (C) 2008 Bryan Wu <cooloney@kernel.org>
6 * Copyright (C) 2008 Analog Devices, Inc
8 * Enter bugs at http://blackfin.uclinux.org/
9 */
11 #ifndef __U_UAC1_LEGACY_H
12 #define __U_UAC1_LEGACY_H
14 #include <linux/device.h>
15 #include <linux/err.h>
16 #include <linux/usb/audio.h>
17 #include <linux/usb/composite.h>
19 #include <sound/core.h>
20 #include <sound/pcm.h>
21 #include <sound/pcm_params.h>
23 #define FILE_PCM_PLAYBACK "/dev/snd/pcmC0D0p"
24 #define FILE_PCM_CAPTURE "/dev/snd/pcmC0D0c"
25 #define FILE_CONTROL "/dev/snd/controlC0"
27 #define UAC1_OUT_EP_MAX_PACKET_SIZE 200
28 #define UAC1_REQ_COUNT 256
29 #define UAC1_AUDIO_BUF_SIZE 48000
32 * This represents the USB side of an audio card device, managed by a USB
33 * function which provides control and stream interfaces.
36 struct gaudio_snd_dev {
37 struct gaudio *card;
38 struct file *filp;
39 struct snd_pcm_substream *substream;
40 int access;
41 int format;
42 int channels;
43 int rate;
46 struct gaudio {
47 struct usb_function func;
48 struct usb_gadget *gadget;
50 /* ALSA sound device interfaces */
51 struct gaudio_snd_dev control;
52 struct gaudio_snd_dev playback;
53 struct gaudio_snd_dev capture;
55 /* TODO */
58 struct f_uac1_legacy_opts {
59 struct usb_function_instance func_inst;
60 int req_buf_size;
61 int req_count;
62 int audio_buf_size;
63 char *fn_play;
64 char *fn_cap;
65 char *fn_cntl;
66 unsigned bound:1;
67 unsigned fn_play_alloc:1;
68 unsigned fn_cap_alloc:1;
69 unsigned fn_cntl_alloc:1;
70 struct mutex lock;
71 int refcnt;
74 int gaudio_setup(struct gaudio *card);
75 void gaudio_cleanup(struct gaudio *the_card);
77 size_t u_audio_playback(struct gaudio *card, void *buf, size_t count);
78 int u_audio_get_playback_channels(struct gaudio *card);
79 int u_audio_get_playback_rate(struct gaudio *card);
81 #endif /* __U_UAC1_LEGACY_H */