Lines Matching +full:k +full:- +full:to +full:- +full:j

1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Lee Revell <rlrevell@joe-job.com>
8 * Routines for control of EMU10K1 chips - voice manager
19 * hardware requires stereo interleaved voices be aligned to an even/odd
21 * --rlrevell
28 int i, j, k, skip;
30 for (i = emu->next_free_voice, j = 0; j < NUM_G; i = (i + skip) % NUM_G, j += skip) {
32 dev_dbg(emu->card->dev, "i %d j %d next free %d!\n",
33 i, j, emu->next_free_voice);
42 for (k = 0; k < number; k++) {
43 voice = &emu->voices[i + k];
44 if (voice->use) {
45 skip = k + 1;
50 for (k = 0; k < number; k++) {
51 voice = &emu->voices[i + k];
52 voice->use = type;
53 voice->epcm = epcm;
54 /* dev_dbg(emu->card->dev, "allocated voice %d\n", i + k); */
56 voice->last = 1;
58 *rvoice = &emu->voices[i];
59 emu->next_free_voice = (i + number) % NUM_G;
64 return -ENOMEM; // -EBUSY would have been better
70 if (pvoice->dirty)
71 snd_emu10k1_voice_init(emu, pvoice->number);
72 pvoice->interrupt = NULL;
73 pvoice->use = pvoice->dirty = pvoice->last = 0;
74 pvoice->epcm = NULL;
83 return -EINVAL;
85 return -EINVAL;
87 return -EINVAL;
89 guard(spinlock_irqsave)(&emu->voice_lock);
95 dev_dbg(emu->card->dev, "voice alloc - %i, %i of %i\n",
96 rvoice[got - 1]->number, got, want);
100 if (type != EMU10K1_SYNTH && emu->get_synth_voice) {
102 result = emu->get_synth_voice(emu);
104 voice_free(emu, &emu->voices[result]);
109 for (int j = 0; j < count; j++)
110 voice_free(emu, rvoice[i] + j);
127 return -EINVAL;
128 guard(spinlock_irqsave)(&emu->voice_lock);
130 last = pvoice->last;