Lines Matching +full:first +full:- +full:generation
1 // SPDX-License-Identifier: GPL-2.0-only
3 * fireworks_transaction.c - a part of driver for Fireworks based devices
5 * Copyright (c) 2013-2014 Takashi Sakamoto
14 * At first, 6 data exist. Following to the data, parameters for each command
22 * data[6-]: Parameters
81 t.seqnum = be32_to_cpu(((struct snd_efw_transaction *)cmd)->seqnum) + 1; in snd_efw_transaction_run()
104 dev_err(&t.unit->device, "EFW transaction timed out\n"); in snd_efw_transaction_run()
105 ret = -EIO; in snd_efw_transaction_run()
124 length = min_t(size_t, be32_to_cpu(t->length) * sizeof(u32), length); in copy_resp_to_buf()
126 spin_lock(&efw->lock); in copy_resp_to_buf()
128 if (efw->push_ptr < efw->pull_ptr) in copy_resp_to_buf()
129 capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr); in copy_resp_to_buf()
131 capacity = snd_efw_resp_buf_size - in copy_resp_to_buf()
132 (unsigned int)(efw->push_ptr - efw->pull_ptr); in copy_resp_to_buf()
142 till_end = snd_efw_resp_buf_size - in copy_resp_to_buf()
143 (unsigned int)(efw->push_ptr - efw->resp_buf); in copy_resp_to_buf()
146 memcpy(efw->push_ptr, data, till_end); in copy_resp_to_buf()
148 efw->push_ptr += till_end; in copy_resp_to_buf()
149 if (efw->push_ptr >= efw->resp_buf + snd_efw_resp_buf_size) in copy_resp_to_buf()
150 efw->push_ptr -= snd_efw_resp_buf_size; in copy_resp_to_buf()
152 length -= till_end; in copy_resp_to_buf()
157 wake_up(&efw->hwdep_wait); in copy_resp_to_buf()
161 spin_unlock_irq(&efw->lock); in copy_resp_to_buf()
165 handle_resp_for_user(struct fw_card *card, int generation, int source, in handle_resp_for_user() argument
178 device = fw_parent_device(efw->unit); in handle_resp_for_user()
179 if ((device->card != card) || in handle_resp_for_user()
180 (device->generation != generation)) in handle_resp_for_user()
182 smp_rmb(); /* node id vs. generation */ in handle_resp_for_user()
183 if (device->node_id != source) in handle_resp_for_user()
197 handle_resp_for_kernel(struct fw_card *card, int generation, int source, in handle_resp_for_kernel() argument
206 device = fw_parent_device(t->unit); in handle_resp_for_kernel()
207 if ((device->card != card) || in handle_resp_for_kernel()
208 (device->generation != generation)) in handle_resp_for_kernel()
210 smp_rmb(); /* node_id vs. generation */ in handle_resp_for_kernel()
211 if (device->node_id != source) in handle_resp_for_kernel()
214 if ((t->state == STATE_PENDING) && (t->seqnum == seqnum)) { in handle_resp_for_kernel()
215 t->state = STATE_COMPLETE; in handle_resp_for_kernel()
216 t->size = min_t(unsigned int, length, t->size); in handle_resp_for_kernel()
217 memcpy(t->buf, data, t->size); in handle_resp_for_kernel()
218 wake_up(&t->wait); in handle_resp_for_kernel()
228 int generation, unsigned long long offset, in efw_response() argument
243 seqnum = be32_to_cpu(((struct snd_efw_transaction *)data)->seqnum); in efw_response()
245 handle_resp_for_kernel(card, generation, source, in efw_response()
248 handle_resp_for_user(card, generation, source, in efw_response()
251 handle_resp_for_user(card, generation, source, in efw_response()
295 if ((t->unit == unit) && in snd_efw_transaction_bus_reset()
296 (t->state == STATE_PENDING)) { in snd_efw_transaction_bus_reset()
297 t->state = STATE_BUS_RESET; in snd_efw_transaction_bus_reset()
298 wake_up(&t->wait); in snd_efw_transaction_bus_reset()