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 ...@@ -1439,21 +1439,20 @@ SUB_REG_NC(A_EHC, A_I2S_CAPTURE_RATE, 0x00000e00) /* This sets the capture PCM
/* ------------------- STRUCTURES -------------------- */ /* ------------------- STRUCTURES -------------------- */
enum { enum {
EMU10K1_UNUSED, // This must be zero
EMU10K1_EFX, EMU10K1_EFX,
EMU10K1_EFX_IRQ,
EMU10K1_PCM, EMU10K1_PCM,
EMU10K1_PCM_IRQ,
EMU10K1_SYNTH, EMU10K1_SYNTH,
EMU10K1_MIDI EMU10K1_NUM_TYPES
}; };
struct snd_emu10k1; struct snd_emu10k1;
struct snd_emu10k1_voice { struct snd_emu10k1_voice {
int number; unsigned char number;
unsigned int use: 1, unsigned char use;
pcm: 1,
efx: 1,
synth: 1,
midi: 1;
void (*interrupt)(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice); void (*interrupt)(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
struct snd_emu10k1_pcm *epcm; struct snd_emu10k1_pcm *epcm;
......
...@@ -117,7 +117,7 @@ static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voic ...@@ -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 // period-sized loop as the interrupt source. Additionally, the interrupt
// timing of the hardware is "suboptimal" and needs some compensation. // timing of the hardware is "suboptimal" and needs some compensation.
err = snd_emu10k1_voice_alloc(epcm->emu, 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, 1,
&epcm->extra); &epcm->extra);
if (err < 0) { if (err < 0) {
......
...@@ -367,17 +367,17 @@ static void snd_emu10k1_proc_voices_read(struct snd_info_entry *entry, ...@@ -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 *emu = entry->private_data;
struct snd_emu10k1_voice *voice; struct snd_emu10k1_voice *voice;
int idx; int idx;
static const char * const types[] = {
snd_iprintf(buffer, "ch\tuse\tpcm\tefx\tsynth\tmidi\n"); "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++) { for (idx = 0; idx < NUM_G; idx++) {
voice = &emu->voices[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, idx,
voice->use, types[voice->use]);
voice->pcm,
voice->efx,
voice->synth,
voice->midi);
} }
} }
......
...@@ -78,21 +78,7 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number, ...@@ -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", dev_dbg(emu->card->dev, "voice alloc - %i, %i of %i\n",
voice->number, idx-first_voice+1, number); voice->number, idx-first_voice+1, number);
*/ */
voice->use = 1; voice->use = type;
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;
}
} }
*rvoice = &emu->voices[first_voice]; *rvoice = &emu->voices[first_voice];
return 0; return 0;
...@@ -103,7 +89,7 @@ static void voice_free(struct snd_emu10k1 *emu, ...@@ -103,7 +89,7 @@ static void voice_free(struct snd_emu10k1 *emu,
{ {
snd_emu10k1_voice_init(emu, pvoice->number); snd_emu10k1_voice_init(emu, pvoice->number);
pvoice->interrupt = NULL; pvoice->interrupt = NULL;
pvoice->use = pvoice->pcm = pvoice->synth = pvoice->midi = pvoice->efx = 0; pvoice->use = 0;
pvoice->epcm = NULL; pvoice->epcm = NULL;
} }
...@@ -121,7 +107,7 @@ int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int number, ...@@ -121,7 +107,7 @@ int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int number,
spin_lock_irqsave(&emu->voice_lock, flags); spin_lock_irqsave(&emu->voice_lock, flags);
for (;;) { for (;;) {
result = voice_alloc(emu, type, number, rvoice); result = voice_alloc(emu, type, number, rvoice);
if (result == 0 || type == EMU10K1_SYNTH || type == EMU10K1_MIDI) if (result == 0 || type == EMU10K1_SYNTH)
break; break;
/* free a voice from synth */ /* 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