Commit | Line | Data |
---|---|---|
c6994e6f | 1 | /* |
18b5b3b5 | 2 | * u_uac1.h -- interface to USB gadget "ALSA AUDIO" utilities |
c6994e6f BW |
3 | * |
4 | * Copyright (C) 2008 Bryan Wu <cooloney@kernel.org> | |
5 | * Copyright (C) 2008 Analog Devices, Inc | |
6 | * | |
7 | * Enter bugs at http://blackfin.uclinux.org/ | |
8 | * | |
9 | * Licensed under the GPL-2 or later. | |
10 | */ | |
11 | ||
12 | #ifndef __U_AUDIO_H | |
13 | #define __U_AUDIO_H | |
14 | ||
15 | #include <linux/device.h> | |
16 | #include <linux/err.h> | |
17 | #include <linux/usb/audio.h> | |
18 | #include <linux/usb/composite.h> | |
19 | ||
20 | #include <sound/core.h> | |
21 | #include <sound/pcm.h> | |
22 | #include <sound/pcm_params.h> | |
23 | ||
bcec9784 AP |
24 | #define FILE_PCM_PLAYBACK "/dev/snd/pcmC0D0p" |
25 | #define FILE_PCM_CAPTURE "/dev/snd/pcmC0D0c" | |
26 | #define FILE_CONTROL "/dev/snd/controlC0" | |
27 | ||
28 | #define UAC1_OUT_EP_MAX_PACKET_SIZE 200 | |
29 | #define UAC1_REQ_COUNT 256 | |
30 | #define UAC1_AUDIO_BUF_SIZE 48000 | |
31 | ||
c6994e6f BW |
32 | /* |
33 | * This represents the USB side of an audio card device, managed by a USB | |
34 | * function which provides control and stream interfaces. | |
35 | */ | |
36 | ||
37 | struct gaudio_snd_dev { | |
38 | struct gaudio *card; | |
39 | struct file *filp; | |
40 | struct snd_pcm_substream *substream; | |
41 | int access; | |
42 | int format; | |
43 | int channels; | |
44 | int rate; | |
45 | }; | |
46 | ||
47 | struct gaudio { | |
48 | struct usb_function func; | |
49 | struct usb_gadget *gadget; | |
50 | ||
51 | /* ALSA sound device interfaces */ | |
52 | struct gaudio_snd_dev control; | |
53 | struct gaudio_snd_dev playback; | |
54 | struct gaudio_snd_dev capture; | |
55 | ||
56 | /* TODO */ | |
57 | }; | |
58 | ||
f3a3406b AP |
59 | struct f_uac1_opts { |
60 | struct usb_function_instance func_inst; | |
61 | int req_buf_size; | |
62 | int req_count; | |
63 | int audio_buf_size; | |
64 | char *fn_play; | |
65 | char *fn_cap; | |
66 | char *fn_cntl; | |
0854611a AP |
67 | unsigned bound:1; |
68 | unsigned fn_play_alloc:1; | |
69 | unsigned fn_cap_alloc:1; | |
70 | unsigned fn_cntl_alloc:1; | |
0854611a AP |
71 | struct mutex lock; |
72 | int refcnt; | |
f3a3406b AP |
73 | }; |
74 | ||
c6994e6f | 75 | int gaudio_setup(struct gaudio *card); |
f3a3406b | 76 | void gaudio_cleanup(struct gaudio *the_card); |
f3a3406b AP |
77 | |
78 | size_t u_audio_playback(struct gaudio *card, void *buf, size_t count); | |
79 | int u_audio_get_playback_channels(struct gaudio *card); | |
80 | int u_audio_get_playback_rate(struct gaudio *card); | |
c6994e6f BW |
81 | |
82 | #endif /* __U_AUDIO_H */ |