~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/usb/line6/pcm.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /sound/usb/line6/pcm.h (Version linux-6.12-rc7) and /sound/usb/line6/pcm.h (Version linux-4.11.12)


  1 /* SPDX-License-Identifier: GPL-2.0-only */    << 
  2 /*                                                  1 /*
  3  * Line 6 Linux USB driver                          2  * Line 6 Linux USB driver
  4  *                                                  3  *
  5  * Copyright (C) 2004-2010 Markus Grabner (lin !!   4  * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
                                                   >>   5  *
                                                   >>   6  *      This program is free software; you can redistribute it and/or
                                                   >>   7  *      modify it under the terms of the GNU General Public License as
                                                   >>   8  *      published by the Free Software Foundation, version 2.
                                                   >>   9  *
  6  */                                                10  */
  7                                                    11 
  8 /*                                                 12 /*
  9         PCM interface to POD series devices.       13         PCM interface to POD series devices.
 10 */                                                 14 */
 11                                                    15 
 12 #ifndef PCM_H                                      16 #ifndef PCM_H
 13 #define PCM_H                                      17 #define PCM_H
 14                                                    18 
 15 #include <sound/pcm.h>                             19 #include <sound/pcm.h>
 16                                                    20 
 17 #include "driver.h"                                21 #include "driver.h"
 18                                                    22 
 19 /*                                                 23 /*
 20         number of USB frames per URB               24         number of USB frames per URB
 21         The Line 6 Windows driver always trans     25         The Line 6 Windows driver always transmits two frames per packet, but
 22         the Linux driver performs significantl     26         the Linux driver performs significantly better (i.e., lower latency)
 23         with only one frame per packet.            27         with only one frame per packet.
 24 */                                                 28 */
 25 #define LINE6_ISO_PACKETS       1                  29 #define LINE6_ISO_PACKETS       1
 26                                                    30 
 27 /* in a "full speed" device (such as the PODxt     31 /* in a "full speed" device (such as the PODxt Pro) this means 1ms,
 28  *  for "high speed" it's 1/8ms                    32  *  for "high speed" it's 1/8ms
 29  */                                                33  */
 30 #define LINE6_ISO_INTERVAL      1                  34 #define LINE6_ISO_INTERVAL      1
 31                                                    35 
 32 #define LINE6_IMPULSE_DEFAULT_PERIOD 100           36 #define LINE6_IMPULSE_DEFAULT_PERIOD 100
 33                                                    37 
 34 /*                                                 38 /*
 35         Get substream from Line 6 PCM data str     39         Get substream from Line 6 PCM data structure
 36 */                                                 40 */
 37 #define get_substream(line6pcm, stream) \          41 #define get_substream(line6pcm, stream) \
 38                 (line6pcm->pcm->streams[stream     42                 (line6pcm->pcm->streams[stream].substream)
 39                                                    43 
 40 /*                                                 44 /*
 41         PCM mode bits.                             45         PCM mode bits.
 42                                                    46 
 43         There are several features of the Line     47         There are several features of the Line 6 USB driver which require PCM
 44         data to be exchanged with the device:      48         data to be exchanged with the device:
 45         *) PCM playback and capture via ALSA       49         *) PCM playback and capture via ALSA
 46         *) software monitoring (for devices wi     50         *) software monitoring (for devices without hardware monitoring)
 47         *) optional impulse response measureme     51         *) optional impulse response measurement
 48         However, from the device's point of vi     52         However, from the device's point of view, there is just a single
 49         capture and playback stream, which mus     53         capture and playback stream, which must be shared between these
 50         subsystems. It is therefore necessary      54         subsystems. It is therefore necessary to maintain the state of the
 51         subsystems with respect to PCM usage.      55         subsystems with respect to PCM usage.
 52                                                    56 
 53         We define two bit flags, "opened" and      57         We define two bit flags, "opened" and "running", for each playback
 54         or capture stream.  Both can contain t     58         or capture stream.  Both can contain the bit flag corresponding to
 55         LINE6_STREAM_* type,                       59         LINE6_STREAM_* type,
 56           LINE6_STREAM_PCM = ALSA PCM playback     60           LINE6_STREAM_PCM = ALSA PCM playback or capture
 57           LINE6_STREAM_MONITOR = software moni     61           LINE6_STREAM_MONITOR = software monitoring
 58           IMPULSE = optional impulse response      62           IMPULSE = optional impulse response measurement
 59         The opened flag indicates whether the      63         The opened flag indicates whether the buffer is allocated while
 60         the running flag indicates whether the     64         the running flag indicates whether the stream is running.
 61                                                    65 
 62         For monitor or impulse operations, the     66         For monitor or impulse operations, the driver needs to call
 63         line6_pcm_acquire() or line6_pcm_relea     67         line6_pcm_acquire() or line6_pcm_release() with the appropriate
 64         LINE6_STREAM_* flag.                       68         LINE6_STREAM_* flag.
 65 */                                                 69 */
 66                                                    70 
 67 /* stream types */                                 71 /* stream types */
 68 enum {                                             72 enum {
 69         LINE6_STREAM_PCM,                          73         LINE6_STREAM_PCM,
 70         LINE6_STREAM_MONITOR,                      74         LINE6_STREAM_MONITOR,
 71         LINE6_STREAM_IMPULSE,                      75         LINE6_STREAM_IMPULSE,
 72         LINE6_STREAM_CAPTURE_HELPER,               76         LINE6_STREAM_CAPTURE_HELPER,
 73 };                                                 77 };
 74                                                    78 
 75 /* misc bit flags for PCM operation */             79 /* misc bit flags for PCM operation */
 76 enum {                                             80 enum {
 77         LINE6_FLAG_PAUSE_PLAYBACK,                 81         LINE6_FLAG_PAUSE_PLAYBACK,
 78         LINE6_FLAG_PREPARED,                       82         LINE6_FLAG_PREPARED,
 79 };                                                 83 };
 80                                                    84 
 81 struct line6_pcm_properties {                      85 struct line6_pcm_properties {
 82         struct snd_pcm_hardware playback_hw, c     86         struct snd_pcm_hardware playback_hw, capture_hw;
 83         struct snd_pcm_hw_constraint_ratdens r     87         struct snd_pcm_hw_constraint_ratdens rates;
 84         int bytes_per_channel;                     88         int bytes_per_channel;
 85 };                                                 89 };
 86                                                    90 
 87 struct line6_pcm_stream {                          91 struct line6_pcm_stream {
 88         /* allocated URBs */                       92         /* allocated URBs */
 89         struct urb **urbs;                         93         struct urb **urbs;
 90                                                    94 
 91         /* Temporary buffer;                       95         /* Temporary buffer;
 92          * Since the packet size is not known      96          * Since the packet size is not known in advance, this buffer is
 93          * large enough to store maximum size      97          * large enough to store maximum size packets.
 94          */                                        98          */
 95         unsigned char *buffer;                     99         unsigned char *buffer;
 96                                                   100 
 97         /* Free frame position in the buffer.     101         /* Free frame position in the buffer. */
 98         snd_pcm_uframes_t pos;                    102         snd_pcm_uframes_t pos;
 99                                                   103 
100         /* Count processed bytes;                 104         /* Count processed bytes;
101          * This is modulo period size (to dete    105          * This is modulo period size (to determine when a period is finished).
102          */                                       106          */
103         unsigned bytes;                           107         unsigned bytes;
104                                                   108 
105         /* Counter to create desired sample ra    109         /* Counter to create desired sample rate */
106         unsigned count;                           110         unsigned count;
107                                                   111 
108         /* period size in bytes */                112         /* period size in bytes */
109         unsigned period;                          113         unsigned period;
110                                                   114 
111         /* Processed frame position in the buf    115         /* Processed frame position in the buffer;
112          * The contents of the ring buffer hav    116          * The contents of the ring buffer have been consumed by the USB
113          * subsystem (i.e., sent to the USB de    117          * subsystem (i.e., sent to the USB device) up to this position.
114          */                                       118          */
115         snd_pcm_uframes_t pos_done;               119         snd_pcm_uframes_t pos_done;
116                                                   120 
117         /* Bit mask of active URBs */             121         /* Bit mask of active URBs */
118         unsigned long active_urbs;                122         unsigned long active_urbs;
119                                                   123 
120         /* Bit mask of URBs currently being un    124         /* Bit mask of URBs currently being unlinked */
121         unsigned long unlink_urbs;                125         unsigned long unlink_urbs;
122                                                   126 
123         /* Spin lock to protect updates of the    127         /* Spin lock to protect updates of the buffer positions (not contents)
124          */                                       128          */
125         spinlock_t lock;                          129         spinlock_t lock;
126                                                   130 
127         /* Bit flags for operational stream ty    131         /* Bit flags for operational stream types */
128         unsigned long opened;                     132         unsigned long opened;
129                                                   133 
130         /* Bit flags for running stream types     134         /* Bit flags for running stream types */
131         unsigned long running;                    135         unsigned long running;
132                                                   136 
133         int last_frame;                           137         int last_frame;
134 };                                                138 };
135                                                   139 
136 struct snd_line6_pcm {                            140 struct snd_line6_pcm {
137         /* Pointer back to the Line 6 driver d    141         /* Pointer back to the Line 6 driver data structure */
138         struct usb_line6 *line6;                  142         struct usb_line6 *line6;
139                                                   143 
140         /* Properties. */                         144         /* Properties. */
141         struct line6_pcm_properties *propertie    145         struct line6_pcm_properties *properties;
142                                                   146 
143         /* ALSA pcm stream */                     147         /* ALSA pcm stream */
144         struct snd_pcm *pcm;                      148         struct snd_pcm *pcm;
145                                                   149 
146         /* protection to state changes of in/o    150         /* protection to state changes of in/out streams */
147         struct mutex state_mutex;                 151         struct mutex state_mutex;
148                                                   152 
149         /* Capture and playback streams */        153         /* Capture and playback streams */
150         struct line6_pcm_stream in;               154         struct line6_pcm_stream in;
151         struct line6_pcm_stream out;              155         struct line6_pcm_stream out;
152                                                   156 
153         /* Previously captured frame (for soft    157         /* Previously captured frame (for software monitoring) */
154         unsigned char *prev_fbuf;                 158         unsigned char *prev_fbuf;
155                                                   159 
156         /* Size of previously captured frame (    160         /* Size of previously captured frame (for software monitoring/sync) */
157         int prev_fsize;                           161         int prev_fsize;
158                                                   162 
159         /* Maximum size of USB packet */          163         /* Maximum size of USB packet */
160         int max_packet_size_in;                   164         int max_packet_size_in;
161         int max_packet_size_out;                  165         int max_packet_size_out;
162                                                   166 
163         /* PCM playback volume (left and right    167         /* PCM playback volume (left and right) */
164         int volume_playback[2];                   168         int volume_playback[2];
165                                                   169 
166         /* PCM monitor volume */                  170         /* PCM monitor volume */
167         int volume_monitor;                       171         int volume_monitor;
168                                                   172 
169         /* Volume of impulse response test sig    173         /* Volume of impulse response test signal (if zero, test is disabled) */
170         int impulse_volume;                       174         int impulse_volume;
171                                                   175 
172         /* Period of impulse response test sig    176         /* Period of impulse response test signal */
173         int impulse_period;                       177         int impulse_period;
174                                                   178 
175         /* Counter for impulse response test s    179         /* Counter for impulse response test signal */
176         int impulse_count;                        180         int impulse_count;
177                                                   181 
178         /* Several status bits (see LINE6_FLAG    182         /* Several status bits (see LINE6_FLAG_*) */
179         unsigned long flags;                      183         unsigned long flags;
180 };                                                184 };
181                                                   185 
182 extern int line6_init_pcm(struct usb_line6 *li    186 extern int line6_init_pcm(struct usb_line6 *line6,
183                           struct line6_pcm_pro    187                           struct line6_pcm_properties *properties);
184 extern int snd_line6_trigger(struct snd_pcm_su    188 extern int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd);
185 extern int snd_line6_prepare(struct snd_pcm_su    189 extern int snd_line6_prepare(struct snd_pcm_substream *substream);
186 extern int snd_line6_hw_params(struct snd_pcm_    190 extern int snd_line6_hw_params(struct snd_pcm_substream *substream,
187                                struct snd_pcm_    191                                struct snd_pcm_hw_params *hw_params);
188 extern int snd_line6_hw_free(struct snd_pcm_su    192 extern int snd_line6_hw_free(struct snd_pcm_substream *substream);
189 extern snd_pcm_uframes_t snd_line6_pointer(str    193 extern snd_pcm_uframes_t snd_line6_pointer(struct snd_pcm_substream *substream);
190 extern void line6_pcm_disconnect(struct snd_li    194 extern void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm);
191 extern int line6_pcm_acquire(struct snd_line6_    195 extern int line6_pcm_acquire(struct snd_line6_pcm *line6pcm, int type,
192                                bool start);       196                                bool start);
193 extern void line6_pcm_release(struct snd_line6    197 extern void line6_pcm_release(struct snd_line6_pcm *line6pcm, int type);
194                                                   198 
195 #endif                                            199 #endif
196                                                   200 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php