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

TOMOYO Linux Cross Reference
Linux/sound/firewire/fireface/ff.h

Version: ~ [ linux-5.12-rc1 ] ~ [ linux-5.11.2 ] ~ [ linux-5.10.19 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.101 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.177 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.222 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.258 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.258 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * ff.h - a part of driver for RME Fireface series
  3  *
  4  * Copyright (c) 2015-2017 Takashi Sakamoto
  5  *
  6  * Licensed under the terms of the GNU General Public License, version 2.
  7  */
  8 
  9 #ifndef SOUND_FIREFACE_H_INCLUDED
 10 #define SOUND_FIREFACE_H_INCLUDED
 11 
 12 #include <linux/device.h>
 13 #include <linux/firewire.h>
 14 #include <linux/firewire-constants.h>
 15 #include <linux/module.h>
 16 #include <linux/mod_devicetable.h>
 17 #include <linux/mutex.h>
 18 #include <linux/slab.h>
 19 #include <linux/compat.h>
 20 #include <linux/sched/signal.h>
 21 
 22 #include <sound/core.h>
 23 #include <sound/info.h>
 24 #include <sound/rawmidi.h>
 25 #include <sound/pcm.h>
 26 #include <sound/pcm_params.h>
 27 #include <sound/hwdep.h>
 28 #include <sound/firewire.h>
 29 
 30 #include "../lib.h"
 31 #include "../amdtp-stream.h"
 32 #include "../iso-resources.h"
 33 
 34 #define SND_FF_STREAM_MODES             3
 35 
 36 #define SND_FF_MAXIMIM_MIDI_QUADS       9
 37 #define SND_FF_IN_MIDI_PORTS            2
 38 #define SND_FF_OUT_MIDI_PORTS           2
 39 
 40 struct snd_ff_protocol;
 41 struct snd_ff_spec {
 42         const char *const name;
 43 
 44         const unsigned int pcm_capture_channels[SND_FF_STREAM_MODES];
 45         const unsigned int pcm_playback_channels[SND_FF_STREAM_MODES];
 46 
 47         unsigned int midi_in_ports;
 48         unsigned int midi_out_ports;
 49 
 50         struct snd_ff_protocol *protocol;
 51 };
 52 
 53 struct snd_ff {
 54         struct snd_card *card;
 55         struct fw_unit *unit;
 56         struct mutex mutex;
 57         spinlock_t lock;
 58 
 59         bool registered;
 60         struct delayed_work dwork;
 61 
 62         const struct snd_ff_spec *spec;
 63 
 64         /* To handle MIDI tx. */
 65         struct snd_rawmidi_substream *tx_midi_substreams[SND_FF_IN_MIDI_PORTS];
 66         struct fw_address_handler async_handler;
 67 
 68         /* TO handle MIDI rx. */
 69         struct snd_rawmidi_substream *rx_midi_substreams[SND_FF_OUT_MIDI_PORTS];
 70         u8 running_status[SND_FF_OUT_MIDI_PORTS];
 71         __le32 msg_buf[SND_FF_OUT_MIDI_PORTS][SND_FF_MAXIMIM_MIDI_QUADS];
 72         struct work_struct rx_midi_work[SND_FF_OUT_MIDI_PORTS];
 73         struct fw_transaction transactions[SND_FF_OUT_MIDI_PORTS];
 74         ktime_t next_ktime[SND_FF_OUT_MIDI_PORTS];
 75         bool rx_midi_error[SND_FF_OUT_MIDI_PORTS];
 76         unsigned int rx_bytes[SND_FF_OUT_MIDI_PORTS];
 77 
 78         unsigned int substreams_counter;
 79         struct amdtp_stream tx_stream;
 80         struct amdtp_stream rx_stream;
 81         struct fw_iso_resources tx_resources;
 82         struct fw_iso_resources rx_resources;
 83 
 84         int dev_lock_count;
 85         bool dev_lock_changed;
 86         wait_queue_head_t hwdep_wait;
 87 };
 88 
 89 enum snd_ff_clock_src {
 90         SND_FF_CLOCK_SRC_INTERNAL,
 91         SND_FF_CLOCK_SRC_SPDIF,
 92         SND_FF_CLOCK_SRC_ADAT,
 93         SND_FF_CLOCK_SRC_WORD,
 94         SND_FF_CLOCK_SRC_LTC,
 95         /* TODO: perhaps ADAT2 and TCO exists. */
 96 };
 97 
 98 struct snd_ff_protocol {
 99         int (*get_clock)(struct snd_ff *ff, unsigned int *rate,
100                          enum snd_ff_clock_src *src);
101         int (*begin_session)(struct snd_ff *ff, unsigned int rate);
102         void (*finish_session)(struct snd_ff *ff);
103         int (*switch_fetching_mode)(struct snd_ff *ff, bool enable);
104 
105         void (*dump_sync_status)(struct snd_ff *ff,
106                                  struct snd_info_buffer *buffer);
107         void (*dump_clock_config)(struct snd_ff *ff,
108                                   struct snd_info_buffer *buffer);
109 
110         u64 midi_high_addr_reg;
111         u64 midi_rx_port_0_reg;
112         u64 midi_rx_port_1_reg;
113 };
114 
115 extern struct snd_ff_protocol snd_ff_protocol_ff400;
116 
117 int snd_ff_transaction_register(struct snd_ff *ff);
118 int snd_ff_transaction_reregister(struct snd_ff *ff);
119 void snd_ff_transaction_unregister(struct snd_ff *ff);
120 
121 int amdtp_ff_set_parameters(struct amdtp_stream *s, unsigned int rate,
122                             unsigned int pcm_channels);
123 int amdtp_ff_add_pcm_hw_constraints(struct amdtp_stream *s,
124                                     struct snd_pcm_runtime *runtime);
125 int amdtp_ff_init(struct amdtp_stream *s, struct fw_unit *unit,
126                   enum amdtp_stream_direction dir);
127 
128 int snd_ff_stream_init_duplex(struct snd_ff *ff);
129 void snd_ff_stream_destroy_duplex(struct snd_ff *ff);
130 int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate);
131 void snd_ff_stream_stop_duplex(struct snd_ff *ff);
132 void snd_ff_stream_update_duplex(struct snd_ff *ff);
133 
134 void snd_ff_stream_lock_changed(struct snd_ff *ff);
135 int snd_ff_stream_lock_try(struct snd_ff *ff);
136 void snd_ff_stream_lock_release(struct snd_ff *ff);
137 
138 void snd_ff_proc_init(struct snd_ff *ff);
139 
140 int snd_ff_create_midi_devices(struct snd_ff *ff);
141 
142 int snd_ff_create_pcm_devices(struct snd_ff *ff);
143 
144 int snd_ff_create_hwdep_devices(struct snd_ff *ff);
145 
146 #endif
147 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp