2 * u_uac1.h -- interface to USB gadget "ALSA AUDIO" utilities
4 * Copyright (C) 2008 Bryan Wu <cooloney@kernel.org>
5 * Copyright (C) 2008 Analog Devices, Inc
7 * Enter bugs at http://blackfin.uclinux.org/
9 * Licensed under the GPL-2 or later.
15 #include <linux/device.h>
16 #include <linux/err.h>
17 #include <linux/usb/audio.h>
18 #include <linux/usb/composite.h>
20 #include <sound/core.h>
21 #include <sound/pcm.h>
22 #include <sound/pcm_params.h>
24 #include "gadget_chips.h"
26 #define FILE_PCM_PLAYBACK "/dev/snd/pcmC0D0p"
27 #define FILE_PCM_CAPTURE "/dev/snd/pcmC0D0c"
28 #define FILE_CONTROL "/dev/snd/controlC0"
30 #define UAC1_OUT_EP_MAX_PACKET_SIZE 200
31 #define UAC1_REQ_COUNT 256
32 #define UAC1_AUDIO_BUF_SIZE 48000
35 * This represents the USB side of an audio card device, managed by a USB
36 * function which provides control and stream interfaces.
39 struct gaudio_snd_dev
{
42 struct snd_pcm_substream
*substream
;
50 struct usb_function func
;
51 struct usb_gadget
*gadget
;
53 /* ALSA sound device interfaces */
54 struct gaudio_snd_dev control
;
55 struct gaudio_snd_dev playback
;
56 struct gaudio_snd_dev capture
;
62 struct usb_function_instance func_inst
;
70 unsigned fn_play_alloc
:1;
71 unsigned fn_cap_alloc
:1;
72 unsigned fn_cntl_alloc
:1;
77 int gaudio_setup(struct gaudio
*card
);
78 void gaudio_cleanup(struct gaudio
*the_card
);
80 size_t u_audio_playback(struct gaudio
*card
, void *buf
, size_t count
);
81 int u_audio_get_playback_channels(struct gaudio
*card
);
82 int u_audio_get_playback_rate(struct gaudio
*card
);
84 #endif /* __U_AUDIO_H */