ALSA: emu10k1: improvements related to the driver's procfs
cover ALSA: emu10k1: improvements related to the driver's procfs
FIXME: the last commit is still being tested; something appears fishy.
Oswald Buddenhagen (6):
ALSA: emu10k1: hide absent 2nd pointer-offset register set from /proc
ALSA: emu10k1: fix writing 1st pointer-offset register set through
/proc
ALSA: emu10k1: actually disassemble DSP instructions in /proc
ALSA: emu10k1: include FX send amounts in /proc output
ALSA: emu10k1: make E-MU FPGA register dump in /proc more useful
ALSA: emu10k1: vastly improve usefulness of info in /proc
include/sound/emu10k1.h | 11 + sound/pci/emu10k1/emufx.c | 87 ++++--- sound/pci/emu10k1/emuproc.c | 440 ++++++++++++++++++++++-------------- sound/pci/emu10k1/io.c | 28 ++- 4 files changed, 362 insertions(+), 204 deletions(-)
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 1/6 ALSA: emu10k1: hide absent 2nd pointer-offset register set from /proc
The 2nd register set belongs to the P16V chip (or embedded P17V module), so there is nothing to show when no such part is present. Gen2 E-MU cards have a P17V, but it's entirely unused, so we hide it there as well.
--- sound/pci/emu10k1/emuproc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
sound/pci/emu10k1/emuproc.c +13 -9
@@ -561,15 +561,19 @@ int snd_emu10k1_proc_init(struct snd_emu10k1 *emu)snd_card_rw_proc_new (emu->card,"ptr_regs00b" , emu, snd_emu_proc_ptr_reg_read00b, snd_emu_proc_ptr_reg_write00); -snd_card_rw_proc_new (emu->card,"ptr_regs20a" , emu, - snd_emu_proc_ptr_reg_read20a, - snd_emu_proc_ptr_reg_write20); -snd_card_rw_proc_new (emu->card,"ptr_regs20b" , emu, - snd_emu_proc_ptr_reg_read20b, - snd_emu_proc_ptr_reg_write20); -snd_card_rw_proc_new (emu->card,"ptr_regs20c" , emu, - snd_emu_proc_ptr_reg_read20c, - snd_emu_proc_ptr_reg_write20); +if (!emu->card_capabilities->emu_model && + (emu->card_capabilities->ca0151_chip || emu->card_capabilities->ca0108_chip)) { +snd_card_rw_proc_new (emu->card,"ptr_regs20a" , emu, + snd_emu_proc_ptr_reg_read20a, + snd_emu_proc_ptr_reg_write20); +snd_card_rw_proc_new (emu->card,"ptr_regs20b" , emu, + snd_emu_proc_ptr_reg_read20b, + snd_emu_proc_ptr_reg_write20); +if (emu->card_capabilities->ca0108_chip) +snd_card_rw_proc_new (emu->card,"ptr_regs20c" , emu, + snd_emu_proc_ptr_reg_read20c, + snd_emu_proc_ptr_reg_write20); + }#endif snd_card_ro_proc_new (emu->card,"emu10k1" , emu, snd_emu10k1_proc_read);
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 2/6 ALSA: emu10k1: fix writing 1st pointer-offset register set through /proc
In reply to Oswald BuddenhagenThe limits were appropriate only for the 2nd set.
FWIW, the channel count 4 for the 2nd set is suspicious as well - at least P17V_PLAYBACK_FIFO_PTR actually has 8 channels, and comments on HCFG2 hint at that as well. But all bitmasks are documented only for 4 channels. Anyway, rectifying that is out of scope for this patch.
--- sound/pci/emu10k1/emuproc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
sound/pci/emu10k1/emuproc.c +7 -4
@@ -483,29 +483,32 @@ static void snd_emu_proc_ptr_reg_read(struct snd_info_entry *entry, }static void snd_emu_proc_ptr_reg_write (struct snd_info_entry *entry, -struct snd_info_buffer *buffer,int iobase) +struct snd_info_buffer *buffer, +int iobase,int length,int voices) {struct snd_emu10k1 *emu = entry->private_data;char line[64 ];unsigned int reg, channel_id , val;while (!snd_info_get_line (buffer, line,sizeof (line))) {if (sscanf (line,"%x %x %x" , ®, &channel_id, &val) !=3 )continue ; -if (reg <0xa0 && val <=0xffffffff && channel_id <=3 ) +if (reg < length && channel_id < voices)snd_ptr_write (emu, iobase, reg, channel_id, val); } }static void snd_emu_proc_ptr_reg_write00 (struct snd_info_entry *entry,struct snd_info_buffer *buffer) { -snd_emu_proc_ptr_reg_write (entry, buffer,0 ); +snd_emu_proc_ptr_reg_write (entry, buffer,0 ,0x80 ,64 ); }static void snd_emu_proc_ptr_reg_write20 (struct snd_info_entry *entry,struct snd_info_buffer *buffer) { -snd_emu_proc_ptr_reg_write (entry, buffer,0x20 ); +struct snd_emu10k1 *emu = entry->private_data; +snd_emu_proc_ptr_reg_write (entry, buffer,0x20 , + emu->card_capabilities->ca0108_chip ?0xa0 :0x80 ,4 ); }
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 3/6 ALSA: emu10k1: actually disassemble DSP instructions in /proc
In reply to Oswald BuddenhagenThis is supposed to be an actually readable representation; the binary is already in another file.
--- sound/pci/emu10k1/emuproc.c | 148 +++++++++++++++++++++++++++++++----- 1 file changed, 129 insertions(+), 19 deletions(-)
sound/pci/emu10k1/emuproc.c +129 -19
@@ -275,37 +275,147 @@ static void snd_emu10k1_proc_rates_read(struct snd_info_entry *entry, } } -static void snd_emu10k1_proc_acode_read (struct snd_info_entry *entry, +struct emu10k1_reg_entry { +unsigned short base, size; +const char *name; +}; + +static const struct emu10k1_reg_entry sblive_reg_entries[] = { + {0 ,0x10 ,"FXBUS" }, + {0x10 ,0x10 ,"EXTIN" }, + {0x20 ,0x10 ,"EXTOUT" }, + {0x30 ,0x10 ,"FXBUS2" }, + {0x40 ,0x20 ,NULL },// Constants + {0x100 ,0x100 ,"GPR" }, + {0x200 ,0x80 ,"ITRAM_DATA" }, + {0x280 ,0x20 ,"ETRAM_DATA" }, + {0x300 ,0x80 ,"ITRAM_ADDR" }, + {0x380 ,0x20 ,"ETRAM_ADDR" }, + {0x400 ,0 ,0 } +}; + +static const struct emu10k1_reg_entry audigy_reg_entries[] = { + {0 ,0x40 ,"FXBUS" }, + {0x40 ,0x10 ,"EXTIN" }, + {0x50 ,0x10 ,"P16VIN" }, + {0x60 ,0x20 ,"EXTOUT" }, + {0x80 ,0x20 ,"FXBUS2" }, + {0xa0 ,0x10 ,"EMU32OUTH" }, + {0xb0 ,0x10 ,"EMU32OUTL" }, + {0xc0 ,0x20 ,NULL },// Constants +// This can't be quite right - overlap. +//{ 0x100, 0xc0, "ITRAM_CTL" }, +//{ 0x1c0, 0x40, "ETRAM_CTL" }, + {0x160 ,0x20 ,"A3_EMU32IN" }, + {0x1e0 ,0x20 ,"A3_EMU32OUT" }, + {0x200 ,0xc0 ,"ITRAM_DATA" }, + {0x2c0 ,0x40 ,"ETRAM_DATA" }, + {0x300 ,0xc0 ,"ITRAM_ADDR" }, + {0x3c0 ,0x40 ,"ETRAM_ADDR" }, + {0x400 ,0x200 ,"GPR" }, + {0x600 ,0 ,0 } +}; + +static const char *const emu10k1_const_entries[] = { +"C_00000000" , +"C_00000001" , +"C_00000002" , +"C_00000003" , +"C_00000004" , +"C_00000008" , +"C_00000010" , +"C_00000020" , +"C_00000100" , +"C_00010000" , +"C_00000800" , +"C_10000000" , +"C_20000000" , +"C_40000000" , +"C_80000000" , +"C_7fffffff" , +"C_ffffffff" , +"C_fffffffe" , +"C_c0000000" , +"C_4f1bbcdc" , +"C_5a7ef9db" , +"C_00100000" , +"GPR_ACCU" , +"GPR_COND" , +"GPR_NOISE0" , +"GPR_NOISE1" , +"GPR_IRQ" , +"GPR_DBAC" , +"GPR_DBACE" , +"???" , +}; + +static int disasm_emu10k1_reg (char *buffer, +const struct emu10k1_reg_entry *entries, +unsigned reg,const char *pfx) +{ +for (int i =0 ; ; i++) { +unsigned base = entries[i].base; +unsigned size = entries[i].size; +if (!size) +return sprintf (buffer,"%s0x%03x" , pfx, reg); +if (reg >= base && reg < base + size) { +const char *name = entries[i].name; + reg -= base; +if (name) +return sprintf (buffer,"%s%s(%u)" , pfx, name, reg); +return sprintf (buffer,"%s%s" , pfx, emu10k1_const_entries[reg]); + } + } +} + +static int disasm_sblive_reg (char *buffer,unsigned reg,const char *pfx) +{ +return disasm_emu10k1_reg (buffer, sblive_reg_entries, reg, pfx); +} + +static int disasm_audigy_reg (char *buffer,unsigned reg,const char *pfx) +{ +return disasm_emu10k1_reg (buffer, audigy_reg_entries, reg, pfx); +} + +static void snd_emu10k1_proc_acode_read (struct snd_info_entry *entry,struct snd_info_buffer *buffer) {u32 pc;struct snd_emu10k1 *emu = entry->private_data; +static const char *const insns[16 ] = { +"MAC0" ,"MAC1" ,"MAC2" ,"MAC3" ,"MACINT0" ,"MACINT1" ,"ACC3" ,"MACMV" , +"ANDXOR" ,"TSTNEG" ,"LIMITGE" ,"LIMITLT" ,"LOG" ,"EXP" ,"INTERP" ,"SKIP" , + };snd_iprintf (buffer,"FX8010 Instruction List '%s'\n" , emu->fx8010.name);snd_iprintf (buffer," Code dump :\n" );for (pc =0 ; pc < (emu->audigy ?1024 :512 ); pc++) {u32 low, high; +int len; +char buf[100 ]; +char *bufp = buf; low =snd_emu10k1_efx_read (emu, pc *2 ); high =snd_emu10k1_efx_read (emu, pc *2 +1 ); -if (emu->audigy) -snd_iprintf (buffer," OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n" , - (high >>24 ) &0x0f , - (high >>12 ) &0x7ff , - (high >>0 ) &0x7ff , - (low >>12 ) &0x7ff , - (low >>0 ) &0x7ff , - pc, - high, low); -else -snd_iprintf (buffer," OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n" , - (high >>20 ) &0x0f , - (high >>10 ) &0x3ff , - (high >>0 ) &0x3ff , - (low >>10 ) &0x3ff , - (low >>0 ) &0x3ff , - pc, - high, low); +if (emu->audigy) { + bufp +=sprintf (bufp," %-7s " , insns[(high >>24 ) &0x0f ]); + bufp +=disasm_audigy_reg (bufp, (high >>12 ) &0x7ff ,"" ); + bufp +=disasm_audigy_reg (bufp, (high >>0 ) &0x7ff ,", " ); + bufp +=disasm_audigy_reg (bufp, (low >>12 ) &0x7ff ,", " ); + bufp +=disasm_audigy_reg (bufp, (low >>0 ) &0x7ff ,", " ); + }else { + bufp +=sprintf (bufp," %-7s " , insns[(high >>20 ) &0x0f ]); + bufp +=disasm_sblive_reg (bufp, (high >>10 ) &0x3ff ,"" ); + bufp +=disasm_sblive_reg (bufp, (high >>0 ) &0x3ff ,", " ); + bufp +=disasm_sblive_reg (bufp, (low >>10 ) &0x3ff ,", " ); + bufp +=disasm_sblive_reg (bufp, (low >>0 ) &0x3ff ,", " ); + } + len = (int )(ptrdiff_t )(bufp - buf); +snd_iprintf (buffer,"%s %s /* 0x%04x: 0x%08x%08x */\n" , + buf, +" " +30 -clamp (65 - len,0 ,30 ), + pc, high, low); } }
Signature · 1 line
2.40.0.152.g15d061e6df
kernel test robot
build botRe: [PATCH 3/6] ALSA: emu10k1: actually disassemble DSP instructions in /proc
kernel test robot noticed the following build warnings:
Hi Oswald,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on tiwai-sound/for-linus linus/master v6.4-rc3 next-20230525] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Oswald-Buddenhagen/ALSA-emu10k1-hide-absent-2nd-pointer-offset-register-set-from-proc/20230526-182102 base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next patch link: https://lore.kernel.org/r/20230526101659.437969-4-oswald.buddenhagen%40gmx.de patch subject: [PATCH 3/6] ALSA: emu10k1: actually disassemble DSP instructions in /proc config: x86_64-randconfig-a014-20230528 (https://download.01.org/0day-ci/archive/20230528/[email protected]/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/13e0e28f29ed98ae73420158c2a879c4e32c694a
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Oswald-Buddenhagen/ALSA-emu10k1-hide-absent-2nd-pointer-offset-register-set-from-proc/20230526-182102 git checkout 13e0e28f29ed98ae73420158c2a879c4e32c694a
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash sound/pci/emu10k1/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> sound/pci/emu10k1/emuproc.c:417:41: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
" " + 30 - clamp(65 - len, 0, 30),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
include/sound/info.h:107:54: note: expanded from macro 'snd_iprintf'
seq_printf((struct seq_file *)(buf)->buffer, fmt, ##args)
^~~~
sound/pci/emu10k1/emuproc.c:417:41: note: use array indexing to silence this warning
" " + 30 - clamp(65 - len, 0, 30),
^
& [
include/sound/info.h:107:54: note: expanded from macro 'snd_iprintf'
seq_printf((struct seq_file *)(buf)->buffer, fmt, ##args)
^1 warning generated.
vim +/int +417 sound/pci/emu10k1/emuproc.c
380
381 static void snd_emu10k1_proc_acode_read(struct snd_info_entry *entry,
382 struct snd_info_buffer *buffer)
383 {
384 u32 pc;
385 struct snd_emu10k1 *emu = entry->private_data;
386 static const char * const insns[16] = {
387 "MAC0", "MAC1", "MAC2", "MAC3", "MACINT0", "MACINT1", "ACC3", "MACMV",
388 "ANDXOR", "TSTNEG", "LIMITGE", "LIMITLT", "LOG", "EXP", "INTERP", "SKIP",
389 };
390
391 snd_iprintf(buffer, "FX8010 Instruction List '%s'\n", emu->fx8010.name);
392 snd_iprintf(buffer, " Code dump :\n");
393 for (pc = 0; pc < (emu->audigy ? 1024 : 512); pc++) {
394 u32 low, high;
395 int len;
396 char buf[100];
397 char *bufp = buf;
398
399 low = snd_emu10k1_efx_read(emu, pc * 2);
400 high = snd_emu10k1_efx_read(emu, pc * 2 + 1);
401 if (emu->audigy) {
402 bufp += sprintf(bufp, " %-7s ", insns[(high >> 24) & 0x0f]);
403 bufp += disasm_audigy_reg(bufp, (high >> 12) & 0x7ff, "");
404 bufp += disasm_audigy_reg(bufp, (high >> 0) & 0x7ff, ", ");
405 bufp += disasm_audigy_reg(bufp, (low >> 12) & 0x7ff, ", ");
406 bufp += disasm_audigy_reg(bufp, (low >> 0) & 0x7ff, ", ");
407 } else {
408 bufp += sprintf(bufp, " %-7s ", insns[(high >> 20) & 0x0f]);
409 bufp += disasm_sblive_reg(bufp, (high >> 10) & 0x3ff, "");
410 bufp += disasm_sblive_reg(bufp, (high >> 0) & 0x3ff, ", ");
411 bufp += disasm_sblive_reg(bufp, (low >> 10) & 0x3ff, ", ");
412 bufp += disasm_sblive_reg(bufp, (low >> 0) & 0x3ff, ", ");
413 }
414 len = (int)(ptrdiff_t)(bufp - buf);
415 snd_iprintf(buffer, "%s %s /* 0x%04x: 0x%08x%08x */\n",
416 buf, > 417 " " + 30 - clamp(65 - len, 0, 30), 418 pc, high, low);
419 }
420 }
421
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 3/6] ALSA: emu10k1: actually disassemble DSP instructions in /proc
In reply to Oswald Buddenhagenkernel test robot noticed the following build warnings:
Hi Oswald,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on tiwai-sound/for-linus linus/master v6.4-rc4 next-20230525] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Oswald-Buddenhagen/ALSA-emu10k1-hide-absent-2nd-pointer-offset-register-set-from-proc/20230526-182102 base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next patch link: https://lore.kernel.org/r/20230526101659.437969-4-oswald.buddenhagen%40gmx.de patch subject: [PATCH 3/6] ALSA: emu10k1: actually disassemble DSP instructions in /proc config: x86_64-randconfig-s021-20230528 (https://download.01.org/0day-ci/archive/20230529/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-12) 11.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/13e0e28f29ed98ae73420158c2a879c4e32c694a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Oswald-Buddenhagen/ALSA-emu10k1-hide-absent-2nd-pointer-offset-register-set-from-proc/20230526-182102 git checkout 13e0e28f29ed98ae73420158c2a879c4e32c694a # save the config file mkdir build_dir && cp config build_dir/.config make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 olddefconfig make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash sound/pci/emu10k1/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> sound/pci/emu10k1/emuproc.c:294:21: sparse: sparse: Using plain integer as NULL pointer
sound/pci/emu10k1/emuproc.c:316:21: sparse: sparse: Using plain integer as NULL pointer
vim +294 sound/pci/emu10k1/emuproc.c
282
283 static const struct emu10k1_reg_entry sblive_reg_entries[] = {
284 { 0, 0x10, "FXBUS" },
285 { 0x10, 0x10, "EXTIN" },
286 { 0x20, 0x10, "EXTOUT" },
287 { 0x30, 0x10, "FXBUS2" },
288 { 0x40, 0x20, NULL }, // Constants
289 { 0x100, 0x100, "GPR" },
290 { 0x200, 0x80, "ITRAM_DATA" },
291 { 0x280, 0x20, "ETRAM_DATA" },
292 { 0x300, 0x80, "ITRAM_ADDR" },
293 { 0x380, 0x20, "ETRAM_ADDR" },
> 294 { 0x400, 0, 0 } 295 };
296
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 4/6 ALSA: emu10k1: include FX send amounts in /proc output
In reply to Oswald BuddenhagenIt seems to make little sense to include the FX send routing, but not the amounts.
This also simplifies the code somewhat, and lines up the output.
--- sound/pci/emu10k1/emuproc.c | 49 +++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 24 deletions(-)
sound/pci/emu10k1/emuproc.c +25 -24
@@ -170,44 +170,45 @@ static void snd_emu10k1_proc_read(struct snd_info_entry *entry, };struct snd_emu10k1 *emu = entry->private_data; -unsigned int val, val1; +unsigned int val, val1, ptrx, psst, dsl, snda;int nefx = emu->audigy ?64 :32 ;const char *const *outputs = emu->audigy ? audigy_outs : creative_outs;int idx;snd_iprintf (buffer,"EMU10K1\n\n" );snd_iprintf (buffer,"Card : %s\n" , emu->audigy ?"Audigy" : (emu->card_capabilities->ecard ?"EMU APS" :"Creative" ));snd_iprintf (buffer,"Internal TRAM (words) : 0x%x\n" , emu->fx8010.itram_size);snd_iprintf (buffer,"External TRAM (words) : 0x%x\n" , (int )emu->fx8010.etram_pages.bytes /2 ); -snd_iprintf (buffer,"\n" ); -snd_iprintf (buffer,"Effect Send Routing :\n" ); + +snd_iprintf (buffer,"\nEffect Send Routing & Amounts:\n" );for (idx =0 ; idx <NUM_G ; idx++) { - val = emu->audigy ? -snd_emu10k1_ptr_read (emu,A_FXRT1 , idx) : -snd_emu10k1_ptr_read (emu,FXRT , idx); - val1 = emu->audigy ? -snd_emu10k1_ptr_read (emu,A_FXRT2 , idx) : -0 ; + ptrx =snd_emu10k1_ptr_read (emu,PTRX , idx); + psst =snd_emu10k1_ptr_read (emu,PSST , idx); + dsl =snd_emu10k1_ptr_read (emu,DSL , idx);if (emu->audigy) { -snd_iprintf (buffer,"Ch%i: A=%i, B=%i, C=%i, D=%i, " , + val =snd_emu10k1_ptr_read (emu,A_FXRT1 , idx); + val1 =snd_emu10k1_ptr_read (emu,A_FXRT2 , idx); + snda =snd_emu10k1_ptr_read (emu,A_SENDAMOUNTS , idx); +snd_iprintf (buffer,"Ch%-2i: A=%2i:%02x, B=%2i:%02x, C=%2i:%02x, D=%2i:%02x, " , idx, - val &0x3f , - (val >>8 ) &0x3f , - (val >>16 ) &0x3f , - (val >>24 ) &0x3f ); -snd_iprintf (buffer,"E=%i, F=%i, G=%i, H=%i\n" , - val1 &0x3f , - (val1 >>8 ) &0x3f , - (val1 >>16 ) &0x3f , - (val1 >>24 ) &0x3f ); + val &0x3f ,REG_VAL_GET (PTRX_FXSENDAMOUNT_A , ptrx), + (val >>8 ) &0x3f ,REG_VAL_GET (PTRX_FXSENDAMOUNT_B , ptrx), + (val >>16 ) &0x3f ,REG_VAL_GET (PSST_FXSENDAMOUNT_C , psst), + (val >>24 ) &0x3f ,REG_VAL_GET (DSL_FXSENDAMOUNT_D , dsl)); +snd_iprintf (buffer,"E=%2i:%02x, F=%2i:%02x, G=%2i:%02x, H=%2i:%02x\n" , + val1 &0x3f , (snda >>24 ) &0xff , + (val1 >>8 ) &0x3f , (snda >>16 ) &0xff , + (val1 >>16 ) &0x3f , (snda >>8 ) &0xff , + (val1 >>24 ) &0x3f , snda &0xff ); }else { -snd_iprintf (buffer,"Ch%i: A=%i, B=%i, C=%i, D=%i\n" , + val =snd_emu10k1_ptr_read (emu,FXRT , idx); +snd_iprintf (buffer,"Ch%-2i: A=%2i:%02x, B=%2i:%02x, C=%2i:%02x, D=%2i:%02x\n" , idx, - (val >>16 ) &0x0f , - (val >>20 ) &0x0f , - (val >>24 ) &0x0f , - (val >>28 ) &0x0f ); + (val >>16 ) &0x0f ,REG_VAL_GET (PTRX_FXSENDAMOUNT_A , ptrx), + (val >>20 ) &0x0f ,REG_VAL_GET (PTRX_FXSENDAMOUNT_B , ptrx), + (val >>24 ) &0x0f ,REG_VAL_GET (PSST_FXSENDAMOUNT_C , psst), + (val >>28 ) &0x0f ,REG_VAL_GET (DSL_FXSENDAMOUNT_D , dsl)); } }snd_iprintf (buffer,"\nCaptured FX Outputs :\n" );
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 5/6 ALSA: emu10k1: make E-MU FPGA register dump in /proc more useful
In reply to Oswald BuddenhagenInclude the routing information, which can be actually read back.
Somewhat as a drive-by, make the register dump format less obscure - the previous one made no sense at all.
--- include/sound/emu10k1.h | 1 + sound/pci/emu10k1/emuproc.c | 43 ++++++++++++++++++++++++++++++++++++- sound/pci/emu10k1/io.c | 28 +++++++++++++++++++++--- 3 files changed, 68 insertions(+), 4 deletions(-)
include/sound/emu10k1.h +1 -0
@@ -1812,6 +1812,7 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, u32 reg, u32 value);void snd_emu1010_fpga_write (struct snd_emu10k1 *emu,u32 reg,u32 value);void snd_emu1010_fpga_read (struct snd_emu10k1 *emu,u32 reg,u32 *value);void snd_emu1010_fpga_link_dst_src_write (struct snd_emu10k1 *emu,u32 dst,u32 src); +u32 snd_emu1010_fpga_link_dst_src_read (struct snd_emu10k1 *emu,u32 dst);unsigned int snd_emu10k1_efx_read (struct snd_emu10k1 *emu,unsigned int pc);void snd_emu10k1_intr_enable (struct snd_emu10k1 *emu,unsigned int intrenb);void snd_emu10k1_intr_disable (struct snd_emu10k1 *emu,unsigned int intrenb);
sound/pci/emu10k1/emuproc.c +42 -1
59 lines not on this page · raw message
sound/pci/emu10k1/io.c +25 -3
@@ -298,21 +298,27 @@ void snd_emu1010_fpga_write(struct snd_emu10k1 *emu, u32 reg, u32 value)spin_unlock_irqrestore (&emu->emu_lock, flags); } -void snd_emu1010_fpga_read (struct snd_emu10k1 *emu,u32 reg,u32 *value) +static void snd_emu1010_fpga_read_locked (struct snd_emu10k1 *emu,u32 reg,u32 *value) {// The higest input pin is used as the designated interrupt trigger, // so it needs to be masked out. u32 mask = emu->card_capabilities->ca0108_chip ?0x1f :0x7f ; -unsigned long flags;if (snd_BUG_ON (reg >0x3f ))return ; reg +=0x40 ;/* 0x40 upwards are registers. */ -spin_lock_irqsave (&emu->emu_lock, flags);outw (reg, emu->port +A_GPIO );udelay (10 );outw (reg |0x80 , emu->port +A_GPIO );/* High bit clocks the value into the fpga. */ udelay (10 ); *value = ((inw (emu->port +A_GPIO ) >>8 ) & mask); +} + +void snd_emu1010_fpga_read (struct snd_emu10k1 *emu,u32 reg,u32 *value) +{ +unsigned long flags; + +spin_lock_irqsave (&emu->emu_lock, flags); +snd_emu1010_fpga_read_locked (emu, reg, value);spin_unlock_irqrestore (&emu->emu_lock, flags); }
@@ -335,6 +341,22 @@ void snd_emu1010_fpga_link_dst_src_write(struct snd_emu10k1 *emu, u32 dst, u32 sspin_unlock_irqrestore (&emu->emu_lock, flags); } +u32 snd_emu1010_fpga_link_dst_src_read (struct snd_emu10k1 *emu,u32 dst) +{ +unsigned long flags; +u32 hi, lo; + +if (snd_BUG_ON (dst & ~0x71f )) +return 0 ; +spin_lock_irqsave (&emu->emu_lock, flags); +snd_emu1010_fpga_write_locked (emu,EMU_HANA_DESTHI , dst >>8 ); +snd_emu1010_fpga_write_locked (emu,EMU_HANA_DESTLO , dst &0x1f ); +snd_emu1010_fpga_read_locked (emu,EMU_HANA_SRCHI , &hi); +snd_emu1010_fpga_read_locked (emu,EMU_HANA_SRCLO , &lo); +spin_unlock_irqrestore (&emu->emu_lock, flags); +return (hi <<8 ) | lo; +} +void snd_emu10k1_intr_enable (struct snd_emu10k1 *emu,unsigned int intrenb) {unsigned long flags;
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH 6/6 ALSA: emu10k1: vastly improve usefulness of info in /proc
In reply to Oswald Buddenhagen- Include the FX bus map, without which the already present send routing info would require looking up the documentation.
- Include the physical I/O channels as known to the driver
- Make the multi-channel capture map actually name the mapped input channels rather than "FXBUS" (Audigy) or even "???" (SbLive)
- The latter two are omitted for E-MU cards, as their physical I/O is routed through the FPGA
- While at it, make the "Card" field somewhat more useful
This includes de-duplicating the label tables between emuproc and emufx, updating/improving the FX bus label table, and making the SB Live! 5.1 multi-track capture channel mapping hack data-driven.
--- include/sound/emu10k1.h | 10 +++ sound/pci/emu10k1/emufx.c | 87 ++++++++++++------- sound/pci/emu10k1/emuproc.c | 167 ++++++++++++------------------------ 3 files changed, 120 insertions(+), 144 deletions(-)
include/sound/emu10k1.h +10 -0
@@ -1440,6 +1440,16 @@ SUB_REG_NC(A_EHC, A_I2S_CAPTURE_RATE, 0x00000e00) /* This sets the capture PCM/* 0x600 and 0x700 no used */ + +/* ------------------- CONSTANTS -------------------- */ + +extern const char *const snd_emu10k1_fxbus[32 ]; +extern const char *const snd_emu10k1_sblive_ins[16 ]; +extern const char *const snd_emu10k1_audigy_ins[16 ]; +extern const char *const snd_emu10k1_sblive_outs[32 ]; +extern const char *const snd_emu10k1_audigy_outs[32 ]; +extern const s8 snd_emu10k1_sblive51_fxbus2_map[16 ]; +/* ------------------- STRUCTURES -------------------- */ enum {
sound/pci/emu10k1/emufx.c +56 -31
145 lines not on this page · raw message
sound/pci/emu10k1/emuproc.c +54 -113
186 lines not on this page · raw message
Signature · 1 line
2.40.0.152.g15d061e6df
PATCH v2 1/1 ALSA: emu10k1: actually disassemble DSP instructions in /proc
In reply to Oswald Buddenhagenfx8010_acode is supposed to be a human-readable representation; the binary is already in fx8010_code.
---
v2:
- fixed bot warnings
--- sound/pci/emu10k1/emuproc.c | 149 +++++++++++++++++++++++++++++++----- 1 file changed, 130 insertions(+), 19 deletions(-)
sound/pci/emu10k1/emuproc.c +130 -19
@@ -275,37 +275,148 @@ static void snd_emu10k1_proc_rates_read(struct snd_info_entry *entry, } } -static void snd_emu10k1_proc_acode_read (struct snd_info_entry *entry, +struct emu10k1_reg_entry { +unsigned short base, size; +const char *name; +}; + +static const struct emu10k1_reg_entry sblive_reg_entries[] = { + {0 ,0x10 ,"FXBUS" }, + {0x10 ,0x10 ,"EXTIN" }, + {0x20 ,0x10 ,"EXTOUT" }, + {0x30 ,0x10 ,"FXBUS2" }, + {0x40 ,0x20 ,NULL },// Constants + {0x100 ,0x100 ,"GPR" }, + {0x200 ,0x80 ,"ITRAM_DATA" }, + {0x280 ,0x20 ,"ETRAM_DATA" }, + {0x300 ,0x80 ,"ITRAM_ADDR" }, + {0x380 ,0x20 ,"ETRAM_ADDR" }, + {0x400 ,0 ,NULL } +}; + +static const struct emu10k1_reg_entry audigy_reg_entries[] = { + {0 ,0x40 ,"FXBUS" }, + {0x40 ,0x10 ,"EXTIN" }, + {0x50 ,0x10 ,"P16VIN" }, + {0x60 ,0x20 ,"EXTOUT" }, + {0x80 ,0x20 ,"FXBUS2" }, + {0xa0 ,0x10 ,"EMU32OUTH" }, + {0xb0 ,0x10 ,"EMU32OUTL" }, + {0xc0 ,0x20 ,NULL },// Constants +// This can't be quite right - overlap. +//{ 0x100, 0xc0, "ITRAM_CTL" }, +//{ 0x1c0, 0x40, "ETRAM_CTL" }, + {0x160 ,0x20 ,"A3_EMU32IN" }, + {0x1e0 ,0x20 ,"A3_EMU32OUT" }, + {0x200 ,0xc0 ,"ITRAM_DATA" }, + {0x2c0 ,0x40 ,"ETRAM_DATA" }, + {0x300 ,0xc0 ,"ITRAM_ADDR" }, + {0x3c0 ,0x40 ,"ETRAM_ADDR" }, + {0x400 ,0x200 ,"GPR" }, + {0x600 ,0 ,NULL } +}; + +static const char *const emu10k1_const_entries[] = { +"C_00000000" , +"C_00000001" , +"C_00000002" , +"C_00000003" , +"C_00000004" , +"C_00000008" , +"C_00000010" , +"C_00000020" , +"C_00000100" , +"C_00010000" , +"C_00000800" , +"C_10000000" , +"C_20000000" , +"C_40000000" , +"C_80000000" , +"C_7fffffff" , +"C_ffffffff" , +"C_fffffffe" , +"C_c0000000" , +"C_4f1bbcdc" , +"C_5a7ef9db" , +"C_00100000" , +"GPR_ACCU" , +"GPR_COND" , +"GPR_NOISE0" , +"GPR_NOISE1" , +"GPR_IRQ" , +"GPR_DBAC" , +"GPR_DBACE" , +"???" , +}; + +static int disasm_emu10k1_reg (char *buffer, +const struct emu10k1_reg_entry *entries, +unsigned reg,const char *pfx) +{ +for (int i =0 ; ; i++) { +unsigned base = entries[i].base; +unsigned size = entries[i].size; +if (!size) +return sprintf (buffer,"%s0x%03x" , pfx, reg); +if (reg >= base && reg < base + size) { +const char *name = entries[i].name; + reg -= base; +if (name) +return sprintf (buffer,"%s%s(%u)" , pfx, name, reg); +return sprintf (buffer,"%s%s" , pfx, emu10k1_const_entries[reg]); + } + } +} + +static int disasm_sblive_reg (char *buffer,unsigned reg,const char *pfx) +{ +return disasm_emu10k1_reg (buffer, sblive_reg_entries, reg, pfx); +} + +static int disasm_audigy_reg (char *buffer,unsigned reg,const char *pfx) +{ +return disasm_emu10k1_reg (buffer, audigy_reg_entries, reg, pfx); +} + +static void snd_emu10k1_proc_acode_read (struct snd_info_entry *entry,struct snd_info_buffer *buffer) {u32 pc;struct snd_emu10k1 *emu = entry->private_data; +static const char *const insns[16 ] = { +"MAC0" ,"MAC1" ,"MAC2" ,"MAC3" ,"MACINT0" ,"MACINT1" ,"ACC3" ,"MACMV" , +"ANDXOR" ,"TSTNEG" ,"LIMITGE" ,"LIMITLT" ,"LOG" ,"EXP" ,"INTERP" ,"SKIP" , + }; +static const char spaces[] =" " ; +const int nspaces =sizeof (spaces) -1 ;snd_iprintf (buffer,"FX8010 Instruction List '%s'\n" , emu->fx8010.name);snd_iprintf (buffer," Code dump :\n" );for (pc =0 ; pc < (emu->audigy ?1024 :512 ); pc++) {u32 low, high; +int len; +char buf[100 ]; +char *bufp = buf; low =snd_emu10k1_efx_read (emu, pc *2 ); high =snd_emu10k1_efx_read (emu, pc *2 +1 ); -if (emu->audigy) -snd_iprintf (buffer," OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n" , - (high >>24 ) &0x0f , - (high >>12 ) &0x7ff , - (high >>0 ) &0x7ff , - (low >>12 ) &0x7ff , - (low >>0 ) &0x7ff , - pc, - high, low); -else -snd_iprintf (buffer," OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n" , - (high >>20 ) &0x0f , - (high >>10 ) &0x3ff , - (high >>0 ) &0x3ff , - (low >>10 ) &0x3ff , - (low >>0 ) &0x3ff , - pc, - high, low); +if (emu->audigy) { + bufp +=sprintf (bufp," %-7s " , insns[(high >>24 ) &0x0f ]); + bufp +=disasm_audigy_reg (bufp, (high >>12 ) &0x7ff ,"" ); + bufp +=disasm_audigy_reg (bufp, (high >>0 ) &0x7ff ,", " ); + bufp +=disasm_audigy_reg (bufp, (low >>12 ) &0x7ff ,", " ); + bufp +=disasm_audigy_reg (bufp, (low >>0 ) &0x7ff ,", " ); + }else { + bufp +=sprintf (bufp," %-7s " , insns[(high >>20 ) &0x0f ]); + bufp +=disasm_sblive_reg (bufp, (high >>10 ) &0x3ff ,"" ); + bufp +=disasm_sblive_reg (bufp, (high >>0 ) &0x3ff ,", " ); + bufp +=disasm_sblive_reg (bufp, (low >>10 ) &0x3ff ,", " ); + bufp +=disasm_sblive_reg (bufp, (low >>0 ) &0x3ff ,", " ); + } + len = (int )(ptrdiff_t )(bufp - buf); +snd_iprintf (buffer,"%s %s /* 0x%04x: 0x%08x%08x */\n" , + buf, &spaces[nspaces -clamp (65 - len,0 , nspaces)], + pc, high, low); } }
Signature · 1 line
2.40.0.152.g15d061e6df
Quoted 2 lines · Oswald Buddenhagen
FIXME: the last commit is still being tested; something appears fishy.
ignore that; i forgot to amend the description.
Quoted 9 lines
Oswald Buddenhagen (6):
ALSA: emu10k1: hide absent 2nd pointer-offset register set from /proc
ALSA: emu10k1: fix writing 1st pointer-offset register set through
/proc
ALSA: emu10k1: actually disassemble DSP instructions in /proc
ALSA: emu10k1: include FX send amounts in /proc output
ALSA: emu10k1: make E-MU FPGA register dump in /proc more useful
ALSA: emu10k1: vastly improve usefulness of info in /proc
Quoted 11 lines · Oswald Buddenhagen
FIXME: the last commit is still being tested; something appears fishy.
Oswald Buddenhagen (6):
ALSA: emu10k1: hide absent 2nd pointer-offset register set from /proc
ALSA: emu10k1: fix writing 1st pointer-offset register set through
/proc
ALSA: emu10k1: actually disassemble DSP instructions in /proc
ALSA: emu10k1: include FX send amounts in /proc output
ALSA: emu10k1: make E-MU FPGA register dump in /proc more useful
ALSA: emu10k1: vastly improve usefulness of info in /proc
Applied now with the correct patch#3.
thanks,
Takashi