Commit b840f8d8 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen Committed by Takashi Iwai

ALSA: emu10k1: improve voice status display in /proc

Eliminate the MIDI type, as there is no such thing - the MPU401 port
doesn't have anything to do with voices.

For clarity, differentiate between regular and extra voices.

Don't atomize the enum into bits in the table display.

Simplify/optimize the storage.
Signed-off-by: default avatarOswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-4-oswald.buddenhagen@gmx.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3eb5b1d0
......@@ -1439,21 +1439,20 @@ SUB_REG_NC(A_EHC, A_I2S_CAPTURE_RATE, 0x00000e00) /* This sets the capture PCM
/* ------------------- STRUCTURES -------------------- */
enum {
EMU10K1_UNUSED, // This must be zero
EMU10K1_EFX,
EMU10K1_EFX_IRQ,
EMU10K1_PCM,
EMU10K1_PCM_IRQ,
EMU10K1_SYNTH,
EMU10K1_MIDI
EMU10K1_NUM_TYPES
};
struct snd_emu10k1;
struct snd_emu10k1_voice {
int number;
unsigned int use: 1,
pcm: 1,
efx: 1,
synth: 1,
midi: 1;
unsigned char number;
unsigned char use;
void (*interrupt)(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
struct snd_emu10k1_pcm *epcm;
......
......@@ -117,7 +117,7 @@ static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voic
// period-sized loop as the interrupt source. Additionally, the interrupt
// timing of the hardware is "suboptimal" and needs some compensation.
err = snd_emu10k1_voice_alloc(epcm->emu,
epcm->type == PLAYBACK_EMUVOICE ? EMU10K1_PCM : EMU10K1_EFX,
epcm->type == PLAYBACK_EMUVOICE ? EMU10K1_PCM_IRQ : EMU10K1_EFX_IRQ,
1,
&epcm->extra);
if (err < 0) {
......
......@@ -367,17 +367,17 @@ static void snd_emu10k1_proc_voices_read(struct snd_info_entry *entry,
struct snd_emu10k1 *emu = entry->private_data;
struct snd_emu10k1_voice *voice;
int idx;
snd_iprintf(buffer, "ch\tuse\tpcm\tefx\tsynth\tmidi\n");
static const char * const types[] = {
"Unused", "EFX", "EFX IRQ", "PCM", "PCM IRQ", "Synth"
};
static_assert(ARRAY_SIZE(types) == EMU10K1_NUM_TYPES);
snd_iprintf(buffer, "ch\tuse\n");
for (idx = 0; idx < NUM_G; idx++) {
voice = &emu->voices[idx];
snd_iprintf(buffer, "%i\t%i\t%i\t%i\t%i\t%i\n",
snd_iprintf(buffer, "%i\t%s\n",
idx,
voice->use,
voice->pcm,
voice->efx,
voice->synth,
voice->midi);
types[voice->use]);
}
}
......
......@@ -78,21 +78,7 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number,
dev_dbg(emu->card->dev, "voice alloc - %i, %i of %i\n",
voice->number, idx-first_voice+1, number);
*/
voice->use = 1;
switch (type) {
case EMU10K1_PCM:
voice->pcm = 1;
break;
case EMU10K1_SYNTH:
voice->synth = 1;
break;
case EMU10K1_MIDI:
voice->midi = 1;
break;
case EMU10K1_EFX:
voice->efx = 1;
break;
}
voice->use = type;
}
*rvoice = &emu->voices[first_voice];
return 0;
......@@ -103,7 +89,7 @@ static void voice_free(struct snd_emu10k1 *emu,
{
snd_emu10k1_voice_init(emu, pvoice->number);
pvoice->interrupt = NULL;
pvoice->use = pvoice->pcm = pvoice->synth = pvoice->midi = pvoice->efx = 0;
pvoice->use = 0;
pvoice->epcm = NULL;
}
......@@ -121,7 +107,7 @@ int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int number,
spin_lock_irqsave(&emu->voice_lock, flags);
for (;;) {
result = voice_alloc(emu, type, number, rvoice);
if (result == 0 || type == EMU10K1_SYNTH || type == EMU10K1_MIDI)
if (result == 0 || type == EMU10K1_SYNTH)
break;
/* free a voice from synth */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment