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-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * ff-transaction.c - a part of driver for RME Fireface series
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 2015-2017 Takashi Sakamoto
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include "ff.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) static void finish_transmit_midi_msg(struct snd_ff *ff, unsigned int port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 				     int rcode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	struct snd_rawmidi_substream *substream =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 				READ_ONCE(ff->rx_midi_substreams[port]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	if (rcode_is_permanent_error(rcode)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 		ff->rx_midi_error[port] = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	if (rcode != RCODE_COMPLETE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 		/* Transfer the message again, immediately. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 		ff->next_ktime[port] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 		schedule_work(&ff->rx_midi_work[port]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	snd_rawmidi_transmit_ack(substream, ff->rx_bytes[port]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	ff->rx_bytes[port] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	if (!snd_rawmidi_transmit_empty(substream))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 		schedule_work(&ff->rx_midi_work[port]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) static void finish_transmit_midi0_msg(struct fw_card *card, int rcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 				      void *data, size_t length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 				      void *callback_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	struct snd_ff *ff =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		container_of(callback_data, struct snd_ff, transactions[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	finish_transmit_midi_msg(ff, 0, rcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) static void finish_transmit_midi1_msg(struct fw_card *card, int rcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 				      void *data, size_t length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 				      void *callback_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	struct snd_ff *ff =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		container_of(callback_data, struct snd_ff, transactions[1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	finish_transmit_midi_msg(ff, 1, rcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) static void transmit_midi_msg(struct snd_ff *ff, unsigned int port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	struct snd_rawmidi_substream *substream =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 			READ_ONCE(ff->rx_midi_substreams[port]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	int quad_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	struct fw_device *fw_dev = fw_parent_device(ff->unit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	unsigned long long addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	int generation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	fw_transaction_callback_t callback;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	int tcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	if (substream == NULL || snd_rawmidi_transmit_empty(substream))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	if (ff->rx_bytes[port] > 0 || ff->rx_midi_error[port])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	/* Do it in next chance. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	if (ktime_after(ff->next_ktime[port], ktime_get())) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		schedule_work(&ff->rx_midi_work[port]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	quad_count = ff->spec->protocol->fill_midi_msg(ff, substream, port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	if (quad_count <= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	if (port == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		addr = ff->spec->midi_rx_addrs[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		callback = finish_transmit_midi0_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		addr = ff->spec->midi_rx_addrs[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		callback = finish_transmit_midi1_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	/* Set interval to next transaction. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	ff->next_ktime[port] = ktime_add_ns(ktime_get(),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 			ff->rx_bytes[port] * 8 * (NSEC_PER_SEC / 31250));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	if (quad_count == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		tcode = TCODE_WRITE_QUADLET_REQUEST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		tcode = TCODE_WRITE_BLOCK_REQUEST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	 * In Linux FireWire core, when generation is updated with memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	 * barrier, node id has already been updated. In this module, After
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	 * this smp_rmb(), load/store instructions to memory are completed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	 * Thus, both of generation and node id are available with recent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	 * values. This is a light-serialization solution to handle bus reset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	 * events on IEEE 1394 bus.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	generation = fw_dev->generation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	smp_rmb();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	fw_send_request(fw_dev->card, &ff->transactions[port], tcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			fw_dev->node_id, generation, fw_dev->max_speed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			addr, &ff->msg_buf[port], quad_count * 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			callback, &ff->transactions[port]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) static void transmit_midi0_msg(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	struct snd_ff *ff = container_of(work, struct snd_ff, rx_midi_work[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	transmit_midi_msg(ff, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) static void transmit_midi1_msg(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	struct snd_ff *ff = container_of(work, struct snd_ff, rx_midi_work[1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	transmit_midi_msg(ff, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) static void handle_midi_msg(struct fw_card *card, struct fw_request *request,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 			    int tcode, int destination, int source,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 			    int generation, unsigned long long offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 			    void *data, size_t length, void *callback_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	struct snd_ff *ff = callback_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	__le32 *buf = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	fw_send_response(card, request, RCODE_COMPLETE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	offset -= ff->async_handler.offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	ff->spec->protocol->handle_midi_msg(ff, (unsigned int)offset, buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 					    length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static int allocate_own_address(struct snd_ff *ff, int i)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	struct fw_address_region midi_msg_region;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	ff->async_handler.length = ff->spec->midi_addr_range;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	ff->async_handler.address_callback = handle_midi_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	ff->async_handler.callback_data = ff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	midi_msg_region.start = 0x000100000000ull * i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	midi_msg_region.end = midi_msg_region.start + ff->async_handler.length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	err = fw_core_add_address_handler(&ff->async_handler, &midi_msg_region);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	if (err >= 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		/* Controllers are allowed to register this region. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 		if (ff->async_handler.offset & 0x0000ffffffff) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 			fw_core_remove_address_handler(&ff->async_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 			err = -EAGAIN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) // Controllers are allowed to register higher 4 bytes of destination address to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) // receive asynchronous transactions for MIDI messages, while the way to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) // register lower 4 bytes of address is different depending on protocols. For
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) // details, please refer to comments in protocol implementations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) // This driver expects userspace applications to configure registers for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) // lower address because in most cases such registers has the other settings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) int snd_ff_transaction_reregister(struct snd_ff *ff)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	struct fw_card *fw_card = fw_parent_device(ff->unit)->card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	u32 addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	__le32 reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	 * Controllers are allowed to register its node ID and upper 2 byte of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	 * local address to listen asynchronous transactions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	addr = (fw_card->node_id << 16) | (ff->async_handler.offset >> 32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	reg = cpu_to_le32(addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 				  ff->spec->midi_high_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 				  &reg, sizeof(reg), 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) int snd_ff_transaction_register(struct snd_ff *ff)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	int i, err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	 * Allocate in Memory Space of IEC 13213, but lower 4 byte in LSB should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	 * be zero due to device specification.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	for (i = 0; i < 0xffff; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		err = allocate_own_address(ff, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		if (err != -EBUSY && err != -EAGAIN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	if (err < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	err = snd_ff_transaction_reregister(ff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	if (err < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	INIT_WORK(&ff->rx_midi_work[0], transmit_midi0_msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	INIT_WORK(&ff->rx_midi_work[1], transmit_midi1_msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) void snd_ff_transaction_unregister(struct snd_ff *ff)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	__le32 reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	if (ff->async_handler.callback_data == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	ff->async_handler.callback_data = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	/* Release higher 4 bytes of address. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	reg = cpu_to_le32(0x00000000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			   ff->spec->midi_high_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 			   &reg, sizeof(reg), 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	fw_core_remove_address_handler(&ff->async_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }