Merge tag 'kbuild-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
[linux-2.6-block.git] / sound / usb / usx2y / usbusx2y.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef USBUSX2Y_H
3#define USBUSX2Y_H
4#include "../usbaudio.h"
e5779998 5#include "../midi.h"
1da177e4
LT
6#include "usbus428ctldefs.h"
7
8#define NRURBS 2
9
10
11#define URBS_AsyncSeq 10
12#define URB_DataLen_AsyncSeq 32
bbe85bbd
TI
13struct snd_usX2Y_AsyncSeq {
14 struct urb *urb[URBS_AsyncSeq];
15 char *buffer;
16};
1da177e4 17
bbe85bbd 18struct snd_usX2Y_urbSeq {
1da177e4
LT
19 int submitted;
20 int len;
bbe85bbd
TI
21 struct urb *urb[0];
22};
1da177e4 23
1da177e4
LT
24#include "usx2yhwdeppcm.h"
25
bbe85bbd 26struct usX2Ydev {
a014bbad
CL
27 struct usb_device *dev;
28 int card_index;
1da177e4
LT
29 int stride;
30 struct urb *In04urb;
31 void *In04Buf;
32 char In04Last[24];
33 unsigned In04IntCalls;
bbe85bbd 34 struct snd_usX2Y_urbSeq *US04;
1da177e4 35 wait_queue_head_t In04WaitQueue;
bbe85bbd 36 struct snd_usX2Y_AsyncSeq AS04;
1da177e4
LT
37 unsigned int rate,
38 format;
39 int chip_status;
e2439a54 40 struct mutex pcm_mutex;
bbe85bbd 41 struct us428ctls_sharedmem *us428ctls_sharedmem;
1da177e4
LT
42 int wait_iso_frame;
43 wait_queue_head_t us428ctls_wait_queue_head;
bbe85bbd
TI
44 struct snd_usX2Y_hwdep_pcm_shm *hwdep_pcm_shm;
45 struct snd_usX2Y_substream *subs[4];
46 struct snd_usX2Y_substream * volatile prepare_subs;
1da177e4 47 wait_queue_head_t prepare_wait_queue;
d82af9f9 48 struct list_head midi_list;
a014bbad
CL
49 struct list_head pcm_list;
50 int pcm_devs;
bbe85bbd 51};
1da177e4
LT
52
53
54struct snd_usX2Y_substream {
bbe85bbd
TI
55 struct usX2Ydev *usX2Y;
56 struct snd_pcm_substream *pcm_substream;
1da177e4
LT
57
58 int endpoint;
59 unsigned int maxpacksize; /* max packet size in bytes */
60
61 atomic_t state;
62#define state_STOPPED 0
63#define state_STARTING1 1
64#define state_STARTING2 2
65#define state_STARTING3 3
66#define state_PREPARED 4
67#define state_PRERUNNING 6
68#define state_RUNNING 8
69
70 int hwptr; /* free frame position in the buffer (only for playback) */
71 int hwptr_done; /* processed frame position in the buffer */
72 int transfer_done; /* processed frames since last period update */
73
74 struct urb *urb[NRURBS]; /* data urb table */
75 struct urb *completed_urb;
76 char *tmpbuf; /* temporary buffer for playback */
77};
78
79
bbe85bbd 80#define usX2Y(c) ((struct usX2Ydev *)(c)->private_data)
1da177e4 81
bbe85bbd 82int usX2Y_audio_create(struct snd_card *card);
1da177e4 83
bbe85bbd
TI
84int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y);
85int usX2Y_In04_init(struct usX2Ydev *usX2Y);
1da177e4
LT
86
87#define NAME_ALLCAPS "US-X2Y"
88
89#endif