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-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Linux driver for TerraTec DMX 6Fire USB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Author:	Torsten Schenk <torsten.schenk@zoho.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Created:	Jan 01, 2011
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Copyright:	(C) Torsten Schenk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef USB6FIRE_PCM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define USB6FIRE_PCM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <sound/pcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) enum /* settings for pcm */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	/* maximum of EP_W_MAX_PACKET_SIZE[] (see firmware.c) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	PCM_N_URBS = 16, PCM_N_PACKETS_PER_URB = 8, PCM_MAX_PACKET_SIZE = 604
^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) struct pcm_urb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	struct sfire_chip *chip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	/* BEGIN DO NOT SEPARATE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	struct urb instance;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	struct usb_iso_packet_descriptor packets[PCM_N_PACKETS_PER_URB];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	/* END DO NOT SEPARATE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	u8 *buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	struct pcm_urb *peer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct pcm_substream {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	struct snd_pcm_substream *instance;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	bool active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	snd_pcm_uframes_t dma_off; /* current position in alsa dma_area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	snd_pcm_uframes_t period_off; /* current position in current period */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct pcm_runtime {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	struct sfire_chip *chip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	struct snd_pcm *instance;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	struct pcm_substream playback;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	struct pcm_substream capture;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	bool panic; /* if set driver won't do anymore pcm on device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	struct pcm_urb in_urbs[PCM_N_URBS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	struct pcm_urb out_urbs[PCM_N_URBS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	int in_packet_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	int out_packet_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	int in_n_analog; /* number of analog channels soundcard sends */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	int out_n_analog; /* number of analog channels soundcard receives */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	struct mutex stream_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	u8 stream_state; /* one of STREAM_XXX (pcm.c) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	u8 rate; /* one of PCM_RATE_XXX */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	wait_queue_head_t stream_wait_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	bool stream_wait_cond;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) int usb6fire_pcm_init(struct sfire_chip *chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) void usb6fire_pcm_abort(struct sfire_chip *chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) void usb6fire_pcm_destroy(struct sfire_chip *chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #endif /* USB6FIRE_PCM_H */