162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2000 Takashi Iwai <tiwai@suse.de> 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Proc interface for Emu8k/Emu10k1 WaveTable synth 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#include <linux/wait.h> 962306a36Sopenharmony_ci#include <sound/core.h> 1062306a36Sopenharmony_ci#include <sound/emux_synth.h> 1162306a36Sopenharmony_ci#include <sound/info.h> 1262306a36Sopenharmony_ci#include "emux_voice.h" 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_cistatic void 1562306a36Sopenharmony_cisnd_emux_proc_info_read(struct snd_info_entry *entry, 1662306a36Sopenharmony_ci struct snd_info_buffer *buf) 1762306a36Sopenharmony_ci{ 1862306a36Sopenharmony_ci struct snd_emux *emu; 1962306a36Sopenharmony_ci int i; 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci emu = entry->private_data; 2262306a36Sopenharmony_ci mutex_lock(&emu->register_mutex); 2362306a36Sopenharmony_ci if (emu->name) 2462306a36Sopenharmony_ci snd_iprintf(buf, "Device: %s\n", emu->name); 2562306a36Sopenharmony_ci snd_iprintf(buf, "Ports: %d\n", emu->num_ports); 2662306a36Sopenharmony_ci snd_iprintf(buf, "Addresses:"); 2762306a36Sopenharmony_ci for (i = 0; i < emu->num_ports; i++) 2862306a36Sopenharmony_ci snd_iprintf(buf, " %d:%d", emu->client, emu->ports[i]); 2962306a36Sopenharmony_ci snd_iprintf(buf, "\n"); 3062306a36Sopenharmony_ci snd_iprintf(buf, "Use Counter: %d\n", emu->used); 3162306a36Sopenharmony_ci snd_iprintf(buf, "Max Voices: %d\n", emu->max_voices); 3262306a36Sopenharmony_ci snd_iprintf(buf, "Allocated Voices: %d\n", emu->num_voices); 3362306a36Sopenharmony_ci if (emu->memhdr) { 3462306a36Sopenharmony_ci snd_iprintf(buf, "Memory Size: %d\n", emu->memhdr->size); 3562306a36Sopenharmony_ci snd_iprintf(buf, "Memory Available: %d\n", snd_util_mem_avail(emu->memhdr)); 3662306a36Sopenharmony_ci snd_iprintf(buf, "Allocated Blocks: %d\n", emu->memhdr->nblocks); 3762306a36Sopenharmony_ci } else { 3862306a36Sopenharmony_ci snd_iprintf(buf, "Memory Size: 0\n"); 3962306a36Sopenharmony_ci } 4062306a36Sopenharmony_ci if (emu->sflist) { 4162306a36Sopenharmony_ci mutex_lock(&emu->sflist->presets_mutex); 4262306a36Sopenharmony_ci snd_iprintf(buf, "SoundFonts: %d\n", emu->sflist->fonts_size); 4362306a36Sopenharmony_ci snd_iprintf(buf, "Instruments: %d\n", emu->sflist->zone_counter); 4462306a36Sopenharmony_ci snd_iprintf(buf, "Samples: %d\n", emu->sflist->sample_counter); 4562306a36Sopenharmony_ci snd_iprintf(buf, "Locked Instruments: %d\n", emu->sflist->zone_locked); 4662306a36Sopenharmony_ci snd_iprintf(buf, "Locked Samples: %d\n", emu->sflist->sample_locked); 4762306a36Sopenharmony_ci mutex_unlock(&emu->sflist->presets_mutex); 4862306a36Sopenharmony_ci } 4962306a36Sopenharmony_ci#if 0 /* debug */ 5062306a36Sopenharmony_ci if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) { 5162306a36Sopenharmony_ci struct snd_emux_voice *vp = &emu->voices[0]; 5262306a36Sopenharmony_ci snd_iprintf(buf, "voice 0: on\n"); 5362306a36Sopenharmony_ci snd_iprintf(buf, "mod delay=%x, atkhld=%x, dcysus=%x, rel=%x\n", 5462306a36Sopenharmony_ci vp->reg.parm.moddelay, 5562306a36Sopenharmony_ci vp->reg.parm.modatkhld, 5662306a36Sopenharmony_ci vp->reg.parm.moddcysus, 5762306a36Sopenharmony_ci vp->reg.parm.modrelease); 5862306a36Sopenharmony_ci snd_iprintf(buf, "vol delay=%x, atkhld=%x, dcysus=%x, rel=%x\n", 5962306a36Sopenharmony_ci vp->reg.parm.voldelay, 6062306a36Sopenharmony_ci vp->reg.parm.volatkhld, 6162306a36Sopenharmony_ci vp->reg.parm.voldcysus, 6262306a36Sopenharmony_ci vp->reg.parm.volrelease); 6362306a36Sopenharmony_ci snd_iprintf(buf, "lfo1 delay=%x, lfo2 delay=%x, pefe=%x\n", 6462306a36Sopenharmony_ci vp->reg.parm.lfo1delay, 6562306a36Sopenharmony_ci vp->reg.parm.lfo2delay, 6662306a36Sopenharmony_ci vp->reg.parm.pefe); 6762306a36Sopenharmony_ci snd_iprintf(buf, "fmmod=%x, tremfrq=%x, fm2frq2=%x\n", 6862306a36Sopenharmony_ci vp->reg.parm.fmmod, 6962306a36Sopenharmony_ci vp->reg.parm.tremfrq, 7062306a36Sopenharmony_ci vp->reg.parm.fm2frq2); 7162306a36Sopenharmony_ci snd_iprintf(buf, "cutoff=%x, filterQ=%x, chorus=%x, reverb=%x\n", 7262306a36Sopenharmony_ci vp->reg.parm.cutoff, 7362306a36Sopenharmony_ci vp->reg.parm.filterQ, 7462306a36Sopenharmony_ci vp->reg.parm.chorus, 7562306a36Sopenharmony_ci vp->reg.parm.reverb); 7662306a36Sopenharmony_ci snd_iprintf(buf, "avol=%x, acutoff=%x, apitch=%x\n", 7762306a36Sopenharmony_ci vp->avol, vp->acutoff, vp->apitch); 7862306a36Sopenharmony_ci snd_iprintf(buf, "apan=%x, aaux=%x, ptarget=%x, vtarget=%x, ftarget=%x\n", 7962306a36Sopenharmony_ci vp->apan, vp->aaux, 8062306a36Sopenharmony_ci vp->ptarget, 8162306a36Sopenharmony_ci vp->vtarget, 8262306a36Sopenharmony_ci vp->ftarget); 8362306a36Sopenharmony_ci snd_iprintf(buf, "start=%x, end=%x, loopstart=%x, loopend=%x\n", 8462306a36Sopenharmony_ci vp->reg.start, vp->reg.end, vp->reg.loopstart, vp->reg.loopend); 8562306a36Sopenharmony_ci snd_iprintf(buf, "sample_mode=%x, rate=%x\n", vp->reg.sample_mode, vp->reg.rate_offset); 8662306a36Sopenharmony_ci } 8762306a36Sopenharmony_ci#endif 8862306a36Sopenharmony_ci mutex_unlock(&emu->register_mutex); 8962306a36Sopenharmony_ci} 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_civoid snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device) 9362306a36Sopenharmony_ci{ 9462306a36Sopenharmony_ci struct snd_info_entry *entry; 9562306a36Sopenharmony_ci char name[64]; 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci sprintf(name, "wavetableD%d", device); 9862306a36Sopenharmony_ci entry = snd_info_create_card_entry(card, name, card->proc_root); 9962306a36Sopenharmony_ci if (entry == NULL) 10062306a36Sopenharmony_ci return; 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci entry->content = SNDRV_INFO_CONTENT_TEXT; 10362306a36Sopenharmony_ci entry->private_data = emu; 10462306a36Sopenharmony_ci entry->c.text.read = snd_emux_proc_info_read; 10562306a36Sopenharmony_ci} 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_civoid snd_emux_proc_free(struct snd_emux *emu) 10862306a36Sopenharmony_ci{ 10962306a36Sopenharmony_ci snd_info_free_entry(emu->proc); 11062306a36Sopenharmony_ci emu->proc = NULL; 11162306a36Sopenharmony_ci} 112