Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef USBUSX2Y_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define USBUSX2Y_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include "../usbaudio.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include "../midi.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include "usbus428ctldefs.h" 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #define NRURBS	        2	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define URBS_ASYNC_SEQ 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define URB_DATA_LEN_ASYNC_SEQ 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct snd_usx2y_async_seq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	struct urb	*urb[URBS_ASYNC_SEQ];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	char		*buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct snd_usx2y_urb_seq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	int	submitted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	int	len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	struct urb	*urb[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include "usx2yhwdeppcm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct usx2ydev {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	struct usb_device	*dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	int			card_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	int			stride;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	struct urb		*in04_urb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	void			*in04_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	char			in04_last[24];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	unsigned		in04_int_calls;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	struct snd_usx2y_urb_seq	*us04;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	wait_queue_head_t	in04_wait_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	struct snd_usx2y_async_seq	as04;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	unsigned int		rate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 				format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	int			chip_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	struct mutex		pcm_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	struct us428ctls_sharedmem	*us428ctls_sharedmem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	int			wait_iso_frame;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	wait_queue_head_t	us428ctls_wait_queue_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	struct snd_usx2y_hwdep_pcm_shm	*hwdep_pcm_shm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	struct snd_usx2y_substream	*subs[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	struct snd_usx2y_substream	* volatile  prepare_subs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	wait_queue_head_t	prepare_wait_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	struct list_head	midi_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	struct list_head	pcm_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	int			pcm_devs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct snd_usx2y_substream {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	struct usx2ydev	*usx2y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	struct snd_pcm_substream *pcm_substream;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	int			endpoint;		
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	unsigned int		maxpacksize;		/* max packet size in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	atomic_t		state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define STATE_STOPPED	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define STATE_STARTING1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define STATE_STARTING2 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define STATE_STARTING3 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define STATE_PREPARED	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define STATE_PRERUNNING  6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define STATE_RUNNING	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	int			hwptr;			/* free frame position in the buffer (only for playback) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	int			hwptr_done;		/* processed frame position in the buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	int			transfer_done;		/* processed frames since last period update */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	struct urb		*urb[NRURBS];	/* data urb table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	struct urb		*completed_urb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 	char			*tmpbuf;			/* temporary buffer for playback */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define usx2y(c) ((struct usx2ydev *)(c)->private_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) int usx2y_audio_create(struct snd_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) int usx2y_async_seq04_init(struct usx2ydev *usx2y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) int usx2y_in04_init(struct usx2ydev *usx2y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define NAME_ALLCAPS "US-X2Y"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #endif