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

TOMOYO Linux Cross Reference
Linux/sound/firewire/dice/dice.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/firewire/dice/dice.h (Version linux-6.12-rc7) and /sound/firewire/dice/dice.h (Version linux-6.0.19)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*                                                  2 /*
  3  * dice.h - a part of driver for Dice based de      3  * dice.h - a part of driver for Dice based devices
  4  *                                                  4  *
  5  * Copyright (c) Clemens Ladisch                    5  * Copyright (c) Clemens Ladisch
  6  * Copyright (c) 2014 Takashi Sakamoto              6  * Copyright (c) 2014 Takashi Sakamoto
  7  */                                                 7  */
  8                                                     8 
  9 #ifndef SOUND_DICE_H_INCLUDED                       9 #ifndef SOUND_DICE_H_INCLUDED
 10 #define SOUND_DICE_H_INCLUDED                      10 #define SOUND_DICE_H_INCLUDED
 11                                                    11 
 12 #include <linux/compat.h>                          12 #include <linux/compat.h>
 13 #include <linux/completion.h>                      13 #include <linux/completion.h>
 14 #include <linux/delay.h>                           14 #include <linux/delay.h>
 15 #include <linux/device.h>                          15 #include <linux/device.h>
 16 #include <linux/firewire.h>                        16 #include <linux/firewire.h>
 17 #include <linux/firewire-constants.h>              17 #include <linux/firewire-constants.h>
 18 #include <linux/jiffies.h>                         18 #include <linux/jiffies.h>
 19 #include <linux/module.h>                          19 #include <linux/module.h>
 20 #include <linux/mod_devicetable.h>                 20 #include <linux/mod_devicetable.h>
 21 #include <linux/mutex.h>                           21 #include <linux/mutex.h>
 22 #include <linux/slab.h>                            22 #include <linux/slab.h>
 23 #include <linux/spinlock.h>                        23 #include <linux/spinlock.h>
 24 #include <linux/wait.h>                            24 #include <linux/wait.h>
 25 #include <linux/sched/signal.h>                    25 #include <linux/sched/signal.h>
 26                                                    26 
 27 #include <sound/control.h>                         27 #include <sound/control.h>
 28 #include <sound/core.h>                            28 #include <sound/core.h>
 29 #include <sound/firewire.h>                        29 #include <sound/firewire.h>
 30 #include <sound/hwdep.h>                           30 #include <sound/hwdep.h>
 31 #include <sound/info.h>                            31 #include <sound/info.h>
 32 #include <sound/initval.h>                         32 #include <sound/initval.h>
 33 #include <sound/pcm.h>                             33 #include <sound/pcm.h>
 34 #include <sound/pcm_params.h>                      34 #include <sound/pcm_params.h>
 35 #include <sound/rawmidi.h>                         35 #include <sound/rawmidi.h>
 36                                                    36 
 37 #include "../amdtp-am824.h"                        37 #include "../amdtp-am824.h"
 38 #include "../iso-resources.h"                      38 #include "../iso-resources.h"
 39 #include "../lib.h"                                39 #include "../lib.h"
 40 #include "dice-interface.h"                        40 #include "dice-interface.h"
 41                                                    41 
 42 /*                                                 42 /*
 43  * This module support maximum 2 pairs of tx/r     43  * This module support maximum 2 pairs of tx/rx isochronous streams for
 44  * our convinience.                                44  * our convinience.
 45  *                                                 45  *
 46  * In documents for ASICs called with a name o     46  * In documents for ASICs called with a name of 'DICE':
 47  *  - ASIC for DICE II:                            47  *  - ASIC for DICE II:
 48  *   - Maximum 2 tx and 4 rx are supported.        48  *   - Maximum 2 tx and 4 rx are supported.
 49  *   - A packet supports maximum 16 data chann     49  *   - A packet supports maximum 16 data channels.
 50  *  - TCD2210/2210-E (so-called 'Dice Mini'):      50  *  - TCD2210/2210-E (so-called 'Dice Mini'):
 51  *   - Maximum 2 tx and 2 rx are supported.        51  *   - Maximum 2 tx and 2 rx are supported.
 52  *   - A packet supports maximum 16 data chann     52  *   - A packet supports maximum 16 data channels.
 53  *  - TCD2220/2220-E (so-called 'Dice Jr.')        53  *  - TCD2220/2220-E (so-called 'Dice Jr.')
 54  *   - 2 tx and 2 rx are supported.                54  *   - 2 tx and 2 rx are supported.
 55  *   - A packet supports maximum 16 data chann     55  *   - A packet supports maximum 16 data channels.
 56  *  - TCD3070-CH (so-called 'Dice III')            56  *  - TCD3070-CH (so-called 'Dice III')
 57  *   - Maximum 2 tx and 2 rx are supported.        57  *   - Maximum 2 tx and 2 rx are supported.
 58  *   - A packet supports maximum 32 data chann     58  *   - A packet supports maximum 32 data channels.
 59  *                                                 59  *
 60  * For the above, MIDI conformant data channel     60  * For the above, MIDI conformant data channel is just on the first isochronous
 61  * stream.                                         61  * stream.
 62  */                                                62  */
 63 #define MAX_STREAMS     2                          63 #define MAX_STREAMS     2
 64                                                    64 
 65 enum snd_dice_rate_mode {                          65 enum snd_dice_rate_mode {
 66         SND_DICE_RATE_MODE_LOW = 0,                66         SND_DICE_RATE_MODE_LOW = 0,
 67         SND_DICE_RATE_MODE_MIDDLE,                 67         SND_DICE_RATE_MODE_MIDDLE,
 68         SND_DICE_RATE_MODE_HIGH,                   68         SND_DICE_RATE_MODE_HIGH,
 69         SND_DICE_RATE_MODE_COUNT,                  69         SND_DICE_RATE_MODE_COUNT,
 70 };                                                 70 };
 71                                                    71 
 72 struct snd_dice;                                   72 struct snd_dice;
 73 typedef int (*snd_dice_detect_formats_t)(struc     73 typedef int (*snd_dice_detect_formats_t)(struct snd_dice *dice);
 74                                                    74 
 75 struct snd_dice {                                  75 struct snd_dice {
 76         struct snd_card *card;                     76         struct snd_card *card;
 77         struct fw_unit *unit;                      77         struct fw_unit *unit;
 78         spinlock_t lock;                           78         spinlock_t lock;
 79         struct mutex mutex;                        79         struct mutex mutex;
 80                                                    80 
 81         /* Offsets for sub-addresses */            81         /* Offsets for sub-addresses */
 82         unsigned int global_offset;                82         unsigned int global_offset;
 83         unsigned int rx_offset;                    83         unsigned int rx_offset;
 84         unsigned int tx_offset;                    84         unsigned int tx_offset;
 85         unsigned int sync_offset;                  85         unsigned int sync_offset;
 86         unsigned int rsrv_offset;                  86         unsigned int rsrv_offset;
 87                                                    87 
 88         unsigned int clock_caps;                   88         unsigned int clock_caps;
 89         unsigned int tx_pcm_chs[MAX_STREAMS][S     89         unsigned int tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
 90         unsigned int rx_pcm_chs[MAX_STREAMS][S     90         unsigned int rx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
 91         unsigned int tx_midi_ports[MAX_STREAMS     91         unsigned int tx_midi_ports[MAX_STREAMS];
 92         unsigned int rx_midi_ports[MAX_STREAMS     92         unsigned int rx_midi_ports[MAX_STREAMS];
 93                                                    93 
 94         struct fw_address_handler notification     94         struct fw_address_handler notification_handler;
 95         int owner_generation;                      95         int owner_generation;
 96         u32 notification_bits;                     96         u32 notification_bits;
 97                                                    97 
 98         /* For uapi */                             98         /* For uapi */
 99         int dev_lock_count; /* > 0 driver, < 0     99         int dev_lock_count; /* > 0 driver, < 0 userspace */
100         bool dev_lock_changed;                    100         bool dev_lock_changed;
101         wait_queue_head_t hwdep_wait;             101         wait_queue_head_t hwdep_wait;
102                                                   102 
103         /* For streaming */                       103         /* For streaming */
104         struct fw_iso_resources tx_resources[M    104         struct fw_iso_resources tx_resources[MAX_STREAMS];
105         struct fw_iso_resources rx_resources[M    105         struct fw_iso_resources rx_resources[MAX_STREAMS];
106         struct amdtp_stream tx_stream[MAX_STRE    106         struct amdtp_stream tx_stream[MAX_STREAMS];
107         struct amdtp_stream rx_stream[MAX_STRE    107         struct amdtp_stream rx_stream[MAX_STREAMS];
108         bool global_enabled:1;                    108         bool global_enabled:1;
109         bool disable_double_pcm_frames:1;         109         bool disable_double_pcm_frames:1;
110         struct completion clock_accepted;         110         struct completion clock_accepted;
111         unsigned int substreams_counter;          111         unsigned int substreams_counter;
112                                                   112 
113         struct amdtp_domain domain;               113         struct amdtp_domain domain;
114 };                                                114 };
115                                                   115 
116 enum snd_dice_addr_type {                         116 enum snd_dice_addr_type {
117         SND_DICE_ADDR_TYPE_PRIVATE,               117         SND_DICE_ADDR_TYPE_PRIVATE,
118         SND_DICE_ADDR_TYPE_GLOBAL,                118         SND_DICE_ADDR_TYPE_GLOBAL,
119         SND_DICE_ADDR_TYPE_TX,                    119         SND_DICE_ADDR_TYPE_TX,
120         SND_DICE_ADDR_TYPE_RX,                    120         SND_DICE_ADDR_TYPE_RX,
121         SND_DICE_ADDR_TYPE_SYNC,                  121         SND_DICE_ADDR_TYPE_SYNC,
122         SND_DICE_ADDR_TYPE_RSRV,                  122         SND_DICE_ADDR_TYPE_RSRV,
123 };                                                123 };
124                                                   124 
125 int snd_dice_transaction_write(struct snd_dice    125 int snd_dice_transaction_write(struct snd_dice *dice,
126                                enum snd_dice_a    126                                enum snd_dice_addr_type type,
127                                unsigned int of    127                                unsigned int offset,
128                                void *buf, unsi    128                                void *buf, unsigned int len);
129 int snd_dice_transaction_read(struct snd_dice     129 int snd_dice_transaction_read(struct snd_dice *dice,
130                               enum snd_dice_ad    130                               enum snd_dice_addr_type type, unsigned int offset,
131                               void *buf, unsig    131                               void *buf, unsigned int len);
132                                                   132 
133 static inline int snd_dice_transaction_write_g    133 static inline int snd_dice_transaction_write_global(struct snd_dice *dice,
134                                                   134                                                     unsigned int offset,
135                                                   135                                                     void *buf, unsigned int len)
136 {                                                 136 {
137         return snd_dice_transaction_write(dice    137         return snd_dice_transaction_write(dice,
138                                           SND_    138                                           SND_DICE_ADDR_TYPE_GLOBAL, offset,
139                                           buf,    139                                           buf, len);
140 }                                                 140 }
141 static inline int snd_dice_transaction_read_gl    141 static inline int snd_dice_transaction_read_global(struct snd_dice *dice,
142                                                   142                                                    unsigned int offset,
143                                                   143                                                    void *buf, unsigned int len)
144 {                                                 144 {
145         return snd_dice_transaction_read(dice,    145         return snd_dice_transaction_read(dice,
146                                          SND_D    146                                          SND_DICE_ADDR_TYPE_GLOBAL, offset,
147                                          buf,     147                                          buf, len);
148 }                                                 148 }
149 static inline int snd_dice_transaction_write_t    149 static inline int snd_dice_transaction_write_tx(struct snd_dice *dice,
150                                                   150                                                 unsigned int offset,
151                                                   151                                                 void *buf, unsigned int len)
152 {                                                 152 {
153         return snd_dice_transaction_write(dice    153         return snd_dice_transaction_write(dice, SND_DICE_ADDR_TYPE_TX, offset,
154                                           buf,    154                                           buf, len);
155 }                                                 155 }
156 static inline int snd_dice_transaction_read_tx    156 static inline int snd_dice_transaction_read_tx(struct snd_dice *dice,
157                                                   157                                                unsigned int offset,
158                                                   158                                                void *buf, unsigned int len)
159 {                                                 159 {
160         return snd_dice_transaction_read(dice,    160         return snd_dice_transaction_read(dice, SND_DICE_ADDR_TYPE_TX, offset,
161                                          buf,     161                                          buf, len);
162 }                                                 162 }
163 static inline int snd_dice_transaction_write_r    163 static inline int snd_dice_transaction_write_rx(struct snd_dice *dice,
164                                                   164                                                 unsigned int offset,
165                                                   165                                                 void *buf, unsigned int len)
166 {                                                 166 {
167         return snd_dice_transaction_write(dice    167         return snd_dice_transaction_write(dice, SND_DICE_ADDR_TYPE_RX, offset,
168                                           buf,    168                                           buf, len);
169 }                                                 169 }
170 static inline int snd_dice_transaction_read_rx    170 static inline int snd_dice_transaction_read_rx(struct snd_dice *dice,
171                                                   171                                                unsigned int offset,
172                                                   172                                                void *buf, unsigned int len)
173 {                                                 173 {
174         return snd_dice_transaction_read(dice,    174         return snd_dice_transaction_read(dice, SND_DICE_ADDR_TYPE_RX, offset,
175                                          buf,     175                                          buf, len);
176 }                                                 176 }
177 static inline int snd_dice_transaction_write_s    177 static inline int snd_dice_transaction_write_sync(struct snd_dice *dice,
178                                                   178                                                   unsigned int offset,
179                                                   179                                                   void *buf, unsigned int len)
180 {                                                 180 {
181         return snd_dice_transaction_write(dice    181         return snd_dice_transaction_write(dice, SND_DICE_ADDR_TYPE_SYNC, offset,
182                                           buf,    182                                           buf, len);
183 }                                                 183 }
184 static inline int snd_dice_transaction_read_sy    184 static inline int snd_dice_transaction_read_sync(struct snd_dice *dice,
185                                                   185                                                  unsigned int offset,
186                                                   186                                                  void *buf, unsigned int len)
187 {                                                 187 {
188         return snd_dice_transaction_read(dice,    188         return snd_dice_transaction_read(dice, SND_DICE_ADDR_TYPE_SYNC, offset,
189                                          buf,     189                                          buf, len);
190 }                                                 190 }
191                                                   191 
192 int snd_dice_transaction_get_clock_source(stru    192 int snd_dice_transaction_get_clock_source(struct snd_dice *dice,
193                                           unsi    193                                           unsigned int *source);
194 int snd_dice_transaction_get_rate(struct snd_d    194 int snd_dice_transaction_get_rate(struct snd_dice *dice, unsigned int *rate);
195 int snd_dice_transaction_set_enable(struct snd    195 int snd_dice_transaction_set_enable(struct snd_dice *dice);
196 void snd_dice_transaction_clear_enable(struct     196 void snd_dice_transaction_clear_enable(struct snd_dice *dice);
197 int snd_dice_transaction_init(struct snd_dice     197 int snd_dice_transaction_init(struct snd_dice *dice);
198 int snd_dice_transaction_reinit(struct snd_dic    198 int snd_dice_transaction_reinit(struct snd_dice *dice);
199 void snd_dice_transaction_destroy(struct snd_d    199 void snd_dice_transaction_destroy(struct snd_dice *dice);
200                                                   200 
201 #define SND_DICE_RATES_COUNT    7                 201 #define SND_DICE_RATES_COUNT    7
202 extern const unsigned int snd_dice_rates[SND_D    202 extern const unsigned int snd_dice_rates[SND_DICE_RATES_COUNT];
203                                                   203 
204 int snd_dice_stream_get_rate_mode(struct snd_d    204 int snd_dice_stream_get_rate_mode(struct snd_dice *dice, unsigned int rate,
205                                   enum snd_dic    205                                   enum snd_dice_rate_mode *mode);
206 int snd_dice_stream_start_duplex(struct snd_di    206 int snd_dice_stream_start_duplex(struct snd_dice *dice);
207 void snd_dice_stream_stop_duplex(struct snd_di    207 void snd_dice_stream_stop_duplex(struct snd_dice *dice);
208 int snd_dice_stream_init_duplex(struct snd_dic    208 int snd_dice_stream_init_duplex(struct snd_dice *dice);
209 void snd_dice_stream_destroy_duplex(struct snd    209 void snd_dice_stream_destroy_duplex(struct snd_dice *dice);
210 int snd_dice_stream_reserve_duplex(struct snd_    210 int snd_dice_stream_reserve_duplex(struct snd_dice *dice, unsigned int rate,
211                                    unsigned in    211                                    unsigned int events_per_period,
212                                    unsigned in    212                                    unsigned int events_per_buffer);
213 void snd_dice_stream_update_duplex(struct snd_    213 void snd_dice_stream_update_duplex(struct snd_dice *dice);
214 int snd_dice_stream_detect_current_formats(str    214 int snd_dice_stream_detect_current_formats(struct snd_dice *dice);
215                                                   215 
216 int snd_dice_stream_lock_try(struct snd_dice *    216 int snd_dice_stream_lock_try(struct snd_dice *dice);
217 void snd_dice_stream_lock_release(struct snd_d    217 void snd_dice_stream_lock_release(struct snd_dice *dice);
218                                                   218 
219 int snd_dice_create_pcm(struct snd_dice *dice)    219 int snd_dice_create_pcm(struct snd_dice *dice);
220                                                   220 
221 int snd_dice_create_hwdep(struct snd_dice *dic    221 int snd_dice_create_hwdep(struct snd_dice *dice);
222                                                   222 
223 void snd_dice_create_proc(struct snd_dice *dic    223 void snd_dice_create_proc(struct snd_dice *dice);
224                                                   224 
225 int snd_dice_create_midi(struct snd_dice *dice    225 int snd_dice_create_midi(struct snd_dice *dice);
226                                                   226 
227 int snd_dice_detect_tcelectronic_formats(struc    227 int snd_dice_detect_tcelectronic_formats(struct snd_dice *dice);
228 int snd_dice_detect_alesis_formats(struct snd_    228 int snd_dice_detect_alesis_formats(struct snd_dice *dice);
229 int snd_dice_detect_alesis_mastercontrol_forma    229 int snd_dice_detect_alesis_mastercontrol_formats(struct snd_dice *dice);
230 int snd_dice_detect_extension_formats(struct s    230 int snd_dice_detect_extension_formats(struct snd_dice *dice);
231 int snd_dice_detect_mytek_formats(struct snd_d    231 int snd_dice_detect_mytek_formats(struct snd_dice *dice);
232 int snd_dice_detect_presonus_formats(struct sn    232 int snd_dice_detect_presonus_formats(struct snd_dice *dice);
233 int snd_dice_detect_harman_formats(struct snd_    233 int snd_dice_detect_harman_formats(struct snd_dice *dice);
234 int snd_dice_detect_focusrite_pro40_tcd3070_fo << 
235 int snd_dice_detect_weiss_formats(struct snd_d << 
236                                                   234 
237 #endif                                            235 #endif
238                                                   236 

~ [ 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