sound/firewire/fireface/ff.h

Source file repositories/reference/linux-study-clean/sound/firewire/fireface/ff.h

File Facts

System
Linux kernel
Corpus path
sound/firewire/fireface/ff.h
Extension
.h
Size
5266 bytes
Lines
172
Domain
Driver Families
Bucket
sound/firewire
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct snd_ff_spec {
	const unsigned int pcm_capture_channels[SND_FF_STREAM_MODE_COUNT];
	const unsigned int pcm_playback_channels[SND_FF_STREAM_MODE_COUNT];

	unsigned int midi_in_ports;
	unsigned int midi_out_ports;

	const struct snd_ff_protocol *protocol;
	u64 midi_high_addr;
	u8 midi_addr_range;
	u64 midi_rx_addrs[SND_FF_OUT_MIDI_PORTS];
};

struct snd_ff {
	struct snd_card *card;
	struct fw_unit *unit;
	struct mutex mutex;
	spinlock_t lock;

	enum snd_ff_unit_version unit_version;
	const struct snd_ff_spec *spec;

	/* To handle MIDI tx. */
	struct snd_rawmidi_substream *tx_midi_substreams[SND_FF_IN_MIDI_PORTS];
	struct fw_address_handler async_handler;

	/* TO handle MIDI rx. */
	struct snd_rawmidi_substream *rx_midi_substreams[SND_FF_OUT_MIDI_PORTS];
	bool on_sysex[SND_FF_OUT_MIDI_PORTS];
	__le32 msg_buf[SND_FF_OUT_MIDI_PORTS][SND_FF_MAXIMIM_MIDI_QUADS];
	struct work_struct rx_midi_work[SND_FF_OUT_MIDI_PORTS];
	struct fw_transaction transactions[SND_FF_OUT_MIDI_PORTS];
	ktime_t next_ktime[SND_FF_OUT_MIDI_PORTS];
	bool rx_midi_error[SND_FF_OUT_MIDI_PORTS];
	unsigned int rx_bytes[SND_FF_OUT_MIDI_PORTS];

	unsigned int substreams_counter;
	struct amdtp_stream tx_stream;
	struct amdtp_stream rx_stream;
	struct fw_iso_resources tx_resources;
	struct fw_iso_resources rx_resources;

	int dev_lock_count;
	bool dev_lock_changed;
	wait_queue_head_t hwdep_wait;

	struct amdtp_domain domain;

	void *msg_parser;
};

enum snd_ff_clock_src {
	SND_FF_CLOCK_SRC_INTERNAL,
	SND_FF_CLOCK_SRC_SPDIF,
	SND_FF_CLOCK_SRC_ADAT1,
	SND_FF_CLOCK_SRC_ADAT2,
	SND_FF_CLOCK_SRC_WORD,
	SND_FF_CLOCK_SRC_LTC,
	/* TODO: perhaps TCO exists. */
};

struct snd_ff_protocol {
	size_t msg_parser_size;
	bool (*has_msg)(struct snd_ff *ff);
	long (*copy_msg_to_user)(struct snd_ff *ff, char __user *buf, long count);
	void (*handle_msg)(struct snd_ff *ff, unsigned int offset, const __le32 *buf,
			   size_t length, u32 tstamp);
	int (*fill_midi_msg)(struct snd_ff *ff,
			     struct snd_rawmidi_substream *substream,
			     unsigned int port);
	int (*get_clock)(struct snd_ff *ff, unsigned int *rate,
			 enum snd_ff_clock_src *src);
	int (*switch_fetching_mode)(struct snd_ff *ff, bool enable);
	int (*allocate_resources)(struct snd_ff *ff, unsigned int rate);
	int (*begin_session)(struct snd_ff *ff, unsigned int rate);
	void (*finish_session)(struct snd_ff *ff);
	void (*dump_status)(struct snd_ff *ff, struct snd_info_buffer *buffer);
};

extern const struct snd_ff_protocol snd_ff_protocol_ff800;
extern const struct snd_ff_protocol snd_ff_protocol_ff400;
extern const struct snd_ff_protocol snd_ff_protocol_latter;

int snd_ff_transaction_register(struct snd_ff *ff);
int snd_ff_transaction_reregister(struct snd_ff *ff);
void snd_ff_transaction_unregister(struct snd_ff *ff);

int amdtp_ff_set_parameters(struct amdtp_stream *s, unsigned int rate,
			    unsigned int pcm_channels);
int amdtp_ff_add_pcm_hw_constraints(struct amdtp_stream *s,

Annotation

Implementation Notes