Bug 207023 - MOTU M2 regression on duplex audio
Summary: MOTU M2 regression on duplex audio
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-30 10:19 UTC by Erwin Burema
Modified: 2020-10-14 16:19 UTC (History)
9 users (show)

See Also:
Kernel Version: 5.6rc7
Tree: Mainline
Regression: Yes


Attachments
.config file and output of lspci (190.00 KB, application/x-tar)
2020-03-30 10:19 UTC, Erwin Burema
Details
patch to enable duplex usb audio whith implicit feedback (8.61 KB, patch)
2020-04-03 13:07 UTC, Erwin Burema
Details | Diff
fix-pulseaudio-for-motu-m2.patch (917 bytes, patch)
2020-07-30 18:44 UTC, fanantoxa
Details | Diff

Description Erwin Burema 2020-03-30 10:19:29 UTC
Created attachment 288127 [details]
.config file and output of lspci

[1.] One line summary of the problem:
MOTU M2 regression on duplex audio

[2.] Full description of the problem/report:
After installing a recent kernel (I think it started with 5.4) suddenly pulseaudio didn't have duplex audio support anymore and had the following message in my kernel log: 

Unable to change format on ep #81: already in use

Before this had no issues with crackling sound (both with Jack and pulseaudio), although I do force everything to be 48Khz. Interestingly enhough Jack had no problems with this.

[3.] Keywords (i.e., modules, networking, kernel):
motu m2, sound usb, endpoint

[4.] Kernel information


[4.1.] Kernel version (from /proc/version):
Linux version 5.6.0-rc7-test5.6 (eburema@alpha-wolf) (gcc version 9.3.0 (Arch Linux 9.3.0-1)) #1 SMP PREEMPT Mon Mar 30 10:46:51 CEST 2020


[4.2.] Kernel .config file:
See attached file

[5.] Most recent kernel version which did not have the bug:
I think that was 5.3 (before commit da2d50868e59257410fe75315dc99984c3b9fad6 )

[6.] Output of Oops.. message (if applicable) with symbolic information
     resolved (see Documentation/admin-guide/oops-tracing.rst)
NA

[7.] A small shell script or example program which triggers the
     problem (if possible)

NA

[8.] Environment
[8.1.] Software (add the output of the ver_linux script here)


Linux alpha-wolf 5.6.0-rc7-test5.6 #1 SMP PREEMPT Mon Mar 30 10:46:51 CEST 2020 x86_64 GNU/Linux

GNU C                   9.3.0
GNU Make                4.3
Binutils                2.34
Util-linux              2.35.1
Mount                   2.35.1
Module-init-tools       27
E2fsprogs               1.45.6
Jfsutils                1.1.15
Reiserfsprogs           3.6.27
Xfsprogs                5.4.0
Pcmciautils             018
PPP                     2.4.7
Nfs-utils               2.4.3
Bison                   3.5.3
Flex                    2.6.4
Linux C Library         2.31
Dynamic linker (ldd)    2.31
Linux C++ Library       6.0.28
Procps                  3.3.16
Kbd                     2.2.0
Console-tools           2.2.0
Sh-utils                8.31
Udev                    245
Modules Loaded          acpi_cpufreq aesni_intel agpgart ahci amdgpu blake2b_generic bridge btrfs ccp cdrom cec crc32c_generic crc32c_intel crc32_pclmul crct10dif_pclmul cryptd crypto_simd crypto_user dca drm drm_kms_helper edac_mce_amd evdev fat fb_sys_fops fuse ghash_clmulni_intel glue_helper gpu_sched hid hid_generic hid_logitech_dj hid_logitech_hidpp hwmon_vid i2c_algo_bit i2c_piix4 igb input_leds ip6table_filter ip6table_mangle ip6table_nat ip6table_raw ip6_tables ip6table_security ip_set iptable_filter iptable_mangle iptable_nat iptable_raw ip_tables iptable_security irqbypass it87 joydev k10temp kvm kvm_amd ledtrig_audio libahci libata libcrc32c llc mac_hid mc mousedev mxm_wmi nf_conntrack nf_conntrack_broadcast nf_conntrack_netbios_ns nf_defrag_ipv4 nf_defrag_ipv6 nf_nat nfnetlink nf_reject_ipv4 nf_reject_ipv6 nf_tables nf_tables_set nft_chain_nat nft_ct nft_fib nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_masq nft_objref nft_reject nft_reject_inet nls_cp437 nls_iso8859_1 pcspkr pinctrl_amd raid6_pq rng_core scsi_mod sd_mod sg snd snd_hda_codec snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_core snd_hda_intel snd_hwdep snd_intel_dspcfg snd_pcm snd_rawmidi snd_seq_device snd_timer snd_usb_audio snd_usbmidi_lib soundcore sp5100_tco sr_mod stp syscopyarea sysfillrect sysimgblt ttm uinput usbhid vfat vfio vfio_iommu_type1 vfio_pci vfio_virqfd wmi wmi_bmof xhci_hcd xhci_pci xor x_tables


[8.2.] Processor information (from /proc/cpuinfo):
(truncated to only 1 core)
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 23
model           : 113
model name      : AMD Ryzen 9 3900X 12-Core Processor
stepping        : 0
microcode       : 0x8701013
cpu MHz         : 2689.664
cache size      : 512 KB
physical id     : 0
siblings        : 24
core id         : 0
cpu cores       : 12
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 16
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate sme ssbd mba sev ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif umip rdpid overflow_recov succor smca
bugs            : sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass
bogomips        : 7588.61
TLB size        : 3072 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 43 bits physical, 48 bits virtual
power management: ts ttp tm hwpstate cpb eff_freq_ro [13] [14]

[8.3.] Module information (from /proc/modules):

fuse 139264 3 - Live 0x0000000000000000
nft_masq 16384 2 - Live 0x0000000000000000
nft_objref 16384 1 - Live 0x0000000000000000
nf_conntrack_netbios_ns 16384 1 - Live 0x0000000000000000
nf_conntrack_broadcast 16384 1 nf_conntrack_netbios_ns, Live 0x0000000000000000
nft_fib_inet 16384 1 - Live 0x0000000000000000
nft_fib_ipv4 16384 1 nft_fib_inet, Live 0x0000000000000000
nft_fib_ipv6 16384 1 nft_fib_inet, Live 0x0000000000000000
nft_fib 16384 3 nft_fib_inet,nft_fib_ipv4,nft_fib_ipv6, Live 0x0000000000000000
nft_reject_inet 16384 4 - Live 0x0000000000000000
nf_reject_ipv4 16384 1 nft_reject_inet, Live 0x0000000000000000
nf_reject_ipv6 20480 1 nft_reject_inet, Live 0x0000000000000000
nft_reject 16384 1 nft_reject_inet, Live 0x0000000000000000
nft_ct 20480 32 - Live 0x0000000000000000
nf_tables_set 49152 38 - Live 0x0000000000000000
nft_chain_nat 16384 4 - Live 0x0000000000000000
nf_tables 180224 450 nft_masq,nft_objref,nft_fib_inet,nft_fib_ipv4,nft_fib_ipv6,nft_fib,nft_reject_inet,nft_reject,nft_ct,nf_tables_set,nft_chain_nat, Live 0x0000000000000000
ip6table_nat 16384 0 - Live 0x0000000000000000
ip6table_mangle 16384 0 - Live 0x0000000000000000
ip6table_raw 16384 0 - Live 0x0000000000000000
bridge 233472 0 - Live 0x0000000000000000
ip6table_security 16384 0 - Live 0x0000000000000000
iptable_nat 16384 0 - Live 0x0000000000000000
nf_nat 57344 4 nft_masq,nft_chain_nat,ip6table_nat,iptable_nat, Live 0x0000000000000000
stp 16384 1 bridge, Live 0x0000000000000000
llc 16384 2 bridge,stp, Live 0x0000000000000000
nf_conntrack 172032 5 nft_masq,nf_conntrack_netbios_ns,nf_conntrack_broadcast,nft_ct,nf_nat, Live 0x0000000000000000
nf_defrag_ipv6 24576 1 nf_conntrack, Live 0x0000000000000000
nf_defrag_ipv4 16384 1 nf_conntrack, Live 0x0000000000000000
iptable_mangle 16384 0 - Live 0x0000000000000000
iptable_raw 16384 0 - Live 0x0000000000000000
iptable_security 16384 0 - Live 0x0000000000000000
ip_set 57344 0 - Live 0x0000000000000000
nfnetlink 16384 3 nf_tables,ip_set, Live 0x0000000000000000
ip6table_filter 16384 0 - Live 0x0000000000000000
ip6_tables 36864 5 ip6table_nat,ip6table_mangle,ip6table_raw,ip6table_security,ip6table_filter, Live 0x0000000000000000
iptable_filter 16384 0 - Live 0x0000000000000000
it87 65536 0 - Live 0x0000000000000000
hwmon_vid 16384 1 it87, Live 0x0000000000000000
nls_iso8859_1 16384 1 - Live 0x0000000000000000
nls_cp437 20480 1 - Live 0x0000000000000000
vfat 24576 1 - Live 0x0000000000000000
fat 86016 1 vfat, Live 0x0000000000000000
igb 253952 0 - Live 0x0000000000000000
dca 16384 1 igb, Live 0x0000000000000000
hid_logitech_hidpp 45056 0 - Live 0x0000000000000000
mousedev 24576 0 - Live 0x0000000000000000
joydev 28672 0 - Live 0x0000000000000000
input_leds 16384 0 - Live 0x0000000000000000
hid_logitech_dj 28672 0 - Live 0x0000000000000000
edac_mce_amd 32768 0 - Live 0x0000000000000000
kvm_amd 114688 0 - Live 0x0000000000000000
kvm 827392 1 kvm_amd, Live 0x0000000000000000
wmi_bmof 16384 0 - Live 0x0000000000000000
mxm_wmi 16384 0 - Live 0x0000000000000000
snd_hda_codec_realtek 126976 1 - Live 0x0000000000000000
snd_hda_codec_generic 94208 1 snd_hda_codec_realtek, Live 0x0000000000000000
ledtrig_audio 16384 2 snd_hda_codec_realtek,snd_hda_codec_generic, Live 0x0000000000000000
crct10dif_pclmul 16384 1 - Live 0x0000000000000000
snd_hda_codec_hdmi 73728 1 - Live 0x0000000000000000
crc32_pclmul 16384 0 - Live 0x0000000000000000
ghash_clmulni_intel 16384 0 - Live 0x0000000000000000
snd_hda_intel 57344 2 - Live 0x0000000000000000
snd_intel_dspcfg 28672 1 snd_hda_intel, Live 0x0000000000000000
aesni_intel 368640 0 - Live 0x0000000000000000
ccp 114688 1 kvm_amd, Live 0x0000000000000000
snd_hda_codec 163840 4 snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel, Live 0x0000000000000000
sp5100_tco 20480 0 - Live 0x0000000000000000
crypto_simd 16384 1 aesni_intel, Live 0x0000000000000000
cryptd 24576 2 ghash_clmulni_intel,crypto_simd, Live 0x0000000000000000
glue_helper 16384 1 aesni_intel, Live 0x0000000000000000
pcspkr 16384 0 - Live 0x0000000000000000
k10temp 16384 0 - Live 0x0000000000000000
i2c_piix4 28672 0 - Live 0x0000000000000000
snd_hda_core 106496 5 snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec, Live 0x0000000000000000
rng_core 16384 1 ccp, Live 0x0000000000000000
snd_usb_audio 294912 2 - Live 0x0000000000000000
snd_usbmidi_lib 40960 1 snd_usb_audio, Live 0x0000000000000000
snd_hwdep 16384 2 snd_hda_codec,snd_usb_audio, Live 0x0000000000000000
snd_rawmidi 45056 1 snd_usbmidi_lib, Live 0x0000000000000000
snd_seq_device 16384 1 snd_rawmidi, Live 0x0000000000000000
mc 61440 1 snd_usb_audio, Live 0x0000000000000000
snd_pcm 143360 7 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_usb_audio,snd_hda_core, Live 0x0000000000000000
wmi 36864 2 wmi_bmof,mxm_wmi, Live 0x0000000000000000
snd_timer 40960 1 snd_pcm, Live 0x0000000000000000
pinctrl_amd 32768 0 - Live 0x0000000000000000
evdev 24576 17 - Live 0x0000000000000000
mac_hid 16384 0 - Live 0x0000000000000000
snd 110592 18 snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_usb_audio,snd_usbmidi_lib,snd_hwdep,snd_rawmidi,snd_seq_device,snd_pcm,snd_timer, Live 0x0000000000000000
acpi_cpufreq 28672 0 - Live 0x0000000000000000
soundcore 16384 1 snd, Live 0x0000000000000000
uinput 20480 0 - Live 0x0000000000000000
sg 40960 0 - Live 0x0000000000000000
crypto_user 16384 0 - Live 0x0000000000000000
ip_tables 36864 5 iptable_nat,iptable_mangle,iptable_raw,iptable_security,iptable_filter, Live 0x0000000000000000
x_tables 53248 10 ip6table_mangle,ip6table_raw,ip6table_security,iptable_mangle,iptable_raw,iptable_security,ip6table_filter,ip6_tables,iptable_filter,ip_tables, Live 0x0000000000000000
sr_mod 28672 0 - Live 0x0000000000000000
cdrom 77824 1 sr_mod, Live 0x0000000000000000
btrfs 1507328 2 - Live 0x0000000000000000
blake2b_generic 20480 0 - Live 0x0000000000000000
libcrc32c 16384 3 nf_nat,nf_conntrack,btrfs, Live 0x0000000000000000
crc32c_generic 16384 0 - Live 0x0000000000000000
xor 24576 1 btrfs, Live 0x0000000000000000
hid_generic 16384 0 - Live 0x0000000000000000
usbhid 65536 1 hid_logitech_dj, Live 0x0000000000000000
hid 147456 4 hid_logitech_hidpp,hid_logitech_dj,hid_generic,usbhid, Live 0x0000000000000000
sd_mod 57344 8 - Live 0x0000000000000000
raid6_pq 122880 1 btrfs, Live 0x0000000000000000
ahci 40960 4 - Live 0x0000000000000000
crc32c_intel 24576 3 - Live 0x0000000000000000
libahci 45056 1 ahci, Live 0x0000000000000000
libata 294912 2 ahci,libahci, Live 0x0000000000000000
xhci_pci 20480 0 - Live 0x0000000000000000
xhci_hcd 290816 1 xhci_pci, Live 0x0000000000000000
scsi_mod 262144 4 sg,sr_mod,sd_mod,libata, Live 0x0000000000000000
amdgpu 5496832 49 - Live 0x0000000000000000
gpu_sched 40960 1 amdgpu, Live 0x0000000000000000
i2c_algo_bit 16384 2 igb,amdgpu, Live 0x0000000000000000
ttm 122880 1 amdgpu, Live 0x0000000000000000
drm_kms_helper 241664 1 amdgpu, Live 0x0000000000000000
syscopyarea 16384 1 drm_kms_helper, Live 0x0000000000000000
sysfillrect 16384 1 drm_kms_helper, Live 0x0000000000000000
sysimgblt 16384 1 drm_kms_helper, Live 0x0000000000000000
fb_sys_fops 16384 1 drm_kms_helper, Live 0x0000000000000000
cec 65536 1 drm_kms_helper, Live 0x0000000000000000
drm 565248 27 amdgpu,gpu_sched,ttm,drm_kms_helper, Live 0x0000000000000000
agpgart 53248 2 ttm,drm, Live 0x0000000000000000
vfio_pci 57344 0 - Live 0x0000000000000000
irqbypass 16384 2 kvm,vfio_pci, Live 0x0000000000000000
vfio_virqfd 16384 1 vfio_pci, Live 0x0000000000000000
vfio_iommu_type1 32768 0 - Live 0x0000000000000000
vfio 36864 2 vfio_pci,vfio_iommu_type1, Live 0x0000000000000000


[8.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem)
0000-03af : PCI Bus 0000:00
  0000-001f : dma1
  0020-0021 : pic1
  0040-0043 : timer0
  0050-0053 : timer1
  0060-0060 : keyboard
  0061-0061 : PNP0800:00
  0064-0064 : keyboard
  0070-0071 : rtc0
  0080-008f : dma page reg
  00a0-00a1 : pic2
  00c0-00df : dma2
  00f0-00ff : fpu
03b0-03df : PCI Bus 0000:00
03e0-0cf7 : PCI Bus 0000:00
  040b-040b : pnp 00:04
  04d0-04d1 : pnp 00:04
  04d6-04d6 : pnp 00:04
  0800-089f : pnp 00:04
    0800-0803 : ACPI PM1a_EVT_BLK
    0804-0805 : ACPI PM1a_CNT_BLK
    0808-080b : ACPI PM_TMR
    0810-0815 : ACPI CPU throttle
    0820-0827 : ACPI GPE0_BLK
  0900-090f : pnp 00:04
  0910-091f : pnp 00:04
  0a00-0a2f : pnp 00:03
  0a30-0a3f : pnp 00:03
  0a40-0a4f : pnp 00:03
  0a65-0a66 : it87
    0a65-0a66 : it87
  0b00-0b0f : pnp 00:04
  0b20-0b3f : pnp 00:04
  0c00-0c01 : pnp 00:04
  0c14-0c14 : pnp 00:04
  0c50-0c51 : pnp 00:04
  0c52-0c52 : pnp 00:04
  0c6c-0c6c : pnp 00:04
  0c6f-0c6f : pnp 00:04
  0cd0-0cd1 : pnp 00:04
  0cd2-0cd3 : pnp 00:04
  0cd4-0cd5 : pnp 00:04
  0cd6-0cd7 : pnp 00:04
  0cd8-0cdf : pnp 00:04
0cf8-0cff : PCI conf1
0d00-ffff : PCI Bus 0000:00
  d000-dfff : PCI Bus 0000:0a
    d000-d0ff : 0000:0a:00.0
  e000-efff : PCI Bus 0000:09
    e000-e0ff : 0000:09:00.0
  f000-ffff : PCI Bus 0000:02
    f000-ffff : PCI Bus 0000:03
      f000-ffff : PCI Bus 0000:05
        f000-f01f : 0000:05:00.0


00000000-00000fff : Reserved
00001000-0009ffff : System RAM
000a0000-000fffff : Reserved
  000a0000-000bffff : PCI Bus 0000:00
  000c0000-000dffff : PCI Bus 0000:00
    000c0000-000ce7ff : Video ROM
  000f0000-000fffff : System ROM
00100000-09e01fff : System RAM
09e02000-09ffffff : Reserved
0a000000-0a1fffff : System RAM
0a200000-0a20bfff : ACPI Non-volatile Storage
0a20c000-b7275017 : System RAM
b7275018-b7291e57 : System RAM
b7291e58-b7292017 : System RAM
b7292018-b72af057 : System RAM
b72af058-b7313017 : System RAM
b7313018-b7324057 : System RAM
b7324058-ba2a3fff : System RAM
ba2a4000-ba2a4fff : Reserved
ba2a5000-bb654fff : System RAM
bb655000-bb839fff : Reserved
bb83a000-bb9bffff : System RAM
bb9c0000-bbde5fff : ACPI Non-volatile Storage
bbde6000-bcc6efff : Reserved
bcc6f000-beffffff : System RAM
bf000000-bfffffff : Reserved
c0000000-ffffffff : Reserved
  c0000000-fec02fff : PCI Bus 0000:00
    c0000000-d01fffff : PCI Bus 0000:0a
      c0000000-cfffffff : 0000:0a:00.0
      d0000000-d01fffff : 0000:0a:00.0
    e0000000-f01fffff : PCI Bus 0000:09
      e0000000-efffffff : 0000:09:00.0
      f0000000-f01fffff : 0000:09:00.0
    f8000000-fbffffff : PCI MMCONFIG 0000 [bus 00-3f]
      f8000000-fbffffff : Reserved
        f8000000-fbffffff : pnp 00:00
    fc200000-fc7fffff : PCI Bus 0000:02
      fc200000-fc7fffff : PCI Bus 0000:03
        fc200000-fc3fffff : PCI Bus 0000:06
          fc200000-fc2fffff : 0000:06:00.3
          fc200000-fc2fffff : xhci-hcd
          fc300000-fc3fffff : 0000:06:00.1
          fc300000-fc3fffff : xhci-hcd
        fc400000-fc4fffff : PCI Bus 0000:08
          fc400000-fc4007ff : 0000:08:00.0
          fc400000-fc4007ff : ahci
        fc500000-fc5fffff : PCI Bus 0000:07
          fc500000-fc5007ff : 0000:07:00.0
          fc500000-fc5007ff : ahci
        fc600000-fc6fffff : PCI Bus 0000:05
          fc600000-fc61ffff : 0000:05:00.0
          fc600000-fc61ffff : igb
          fc620000-fc623fff : 0000:05:00.0
          fc620000-fc623fff : igb
        fc700000-fc7fffff : PCI Bus 0000:04
          fc700000-fc700fff : 0000:04:00.0
    fc800000-fcafffff : PCI Bus 0000:0c
      fc800000-fc8fffff : 0000:0c:00.3
        fc800000-fc8fffff : xhci-hcd
      fc900000-fc9fffff : 0000:0c:00.1
        fc900000-fc9fffff : ccp
      fca00000-fca07fff : 0000:0c:00.4
        fca00000-fca07fff : ICH HD audio
      fca08000-fca09fff : 0000:0c:00.1
        fca08000-fca09fff : ccp
    fcb00000-fcbfffff : PCI Bus 0000:0e
      fcb00000-fcb007ff : 0000:0e:00.0
        fcb00000-fcb007ff : ahci
    fcc00000-fccfffff : PCI Bus 0000:0d
      fcc00000-fcc007ff : 0000:0d:00.0
        fcc00000-fcc007ff : ahci
    fcd00000-fcdfffff : PCI Bus 0000:0a
      fcd00000-fcd3ffff : 0000:0a:00.0
      fcd40000-fcd5ffff : 0000:0a:00.0
      fcd60000-fcd63fff : 0000:0a:00.1
    fce00000-fcefffff : PCI Bus 0000:09
      fce00000-fce3ffff : 0000:09:00.0
      fce60000-fce63fff : 0000:09:00.1
        fce60000-fce63fff : ICH HD audio
    fcf00000-fcffffff : PCI Bus 0000:01
      fcf00000-fcf03fff : 0000:01:00.0
        fcf00000-fcf03fff : nvme
    fd000000-fd0fffff : pnp 00:01
    feb80000-febfffff : amd_iommu
    fec00000-fec003ff : IOAPIC 0
    fec01000-fec013ff : IOAPIC 1
  fec10000-fec10fff : pnp 00:04
  fed00000-fed003ff : HPET 0
    fed00000-fed003ff : PNP0103:00
  fed81500-fed818ff : AMDI0030:00
  fedc0000-fedc0fff : pnp 00:04
  fee00000-ffffffff : PCI Bus 0000:00
    fee00000-fee00fff : Local APIC
      fee00000-fee00fff : pnp 00:04
    ff000000-ffffffff : pnp 00:04
100000000-83f2fffff : System RAM
  81d800000-81e400f20 : Kernel code
  81e600000-81ea34fff : Kernel rodata
  81ec00000-81ed63e7f : Kernel data
  81f2b2000-81f5fffff : Kernel bss
83f300000-83fffffff : RAM buffer

[8.5.] PCI information ('lspci -vvv' as root)

see attached file

[8.6.] SCSI information (from /proc/scsi/scsi)
Attached devices:
Host: scsi2 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD40EZRZ-00G Rev: 0A80
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD40EZRZ-00G Rev: 0A80
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi5 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD40EZRZ-00G Rev: 0A80
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi8 Channel: 00 Id: 00 Lun: 00
  Vendor: HL-DT-ST Model: BDDVDRW CH10LS20 Rev: 1.01
  Type:   CD-ROM                           ANSI  SCSI revision: 05
Host: scsi9 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD40EZRZ-00G Rev: 0A80
  Type:   Direct-Access                    ANSI  SCSI revision: 05


[8.7.] Other information that might be relevant to the problem
       (please look in /proc and include all information that you
       think to be relevant):

The issue seems to be introduced with commit: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/sound/usb/pcm.c?h=v5.4.28&id=da2d50868e59257410fe75315dc99984c3b9fad6 which is a fix for the MOTU M4 which sadly has the same USB device numbers, removing this fix restores duplex mode with the MOTU M2 in pulseaudio

[X.] Other notes, patches, fixes, workarounds:

Workaround is to comment out line 364 to line 367 in soud/usb/pcm.c
Comment 1 Takashi Iwai 2020-03-30 11:18:50 UTC
Hm, that's unfortunate.

Alexander, any chance to diffenctiate M2 from other models you fixed?
Comment 2 Alexander Tsoy 2020-03-30 12:32:56 UTC
(In reply to Takashi Iwai from comment #1)
I'm pretty sure M2 also doesn't provide explicit feedback endpoint.

(In reply to Erwin Burema from comment #0)
Could you attach lsusb -v -d 07fd:0008 output?
Comment 3 Erwin Burema 2020-03-30 12:39:37 UTC
Output of lsusb -v -d 0fd:0008 as requested


Bus 001 Device 003: ID 07fd:0008 Mark of the Unicorn M2
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x07fd Mark of the Unicorn
  idProduct          0x0008 
  bcdDevice            1.01
  iManufacturer           1 MOTU
  iProduct                3 M2
  iSerial                 2 M20000007839
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0147
    bNumInterfaces          6
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         3
      bFunctionClass          1 Audio
      bFunctionSubClass       0 
      bFunctionProtocol      32 
      iFunction               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol     32 
      iInterface              3 M2
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               2.00
        bCategory               8
        wTotalLength       0x0053
        bmControls           0x00
      AudioControl Interface Descriptor:
        bLength                 8
        bDescriptorType        36
        bDescriptorSubtype     10 (CLOCK_SOURCE)
        bClockID                1
        bmAttributes            3 Internal programmable clock 
        bmControls           0x07
          Clock Frequency Control (read/write)
          Clock Validity Control (read-only)
        bAssocTerminal          0
        iClockSource            9 MOTU Internal Clock
      AudioControl Interface Descriptor:
        bLength                 8
        bDescriptorType        36
        bDescriptorSubtype     11 (CLOCK_SELECTOR)
        bClockID                4
        bNrInPins               1
        baCSourceID(0)          1
        bmControls           0x03
          Clock Selector Control (read/write)
        iClockSelector          8 MOTU Clock Selector
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID            42
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bCSourceID              4
        bNrChannels             2
        bmChannelConfig    0x00000000
        iChannelNames          12 Out 1
        bmControls         0x0000
        iTerminal               6 M2 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            20
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID              42
        bCSourceID              4
        bmControls         0x0000
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID            41
        wTerminalType      0x0201 Microphone
        bAssocTerminal          0
        bCSourceID              4
        bNrChannels             2
        bmChannelConfig    0x00000000
        iChannelNames          14 In 1
        bmControls         0x0000
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            22
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID              41
        bCSourceID              4
        bmControls         0x0000
        iTerminal               7 M2 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0006  1x 6 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              4 M2 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              4 M2 
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          42
        bmControls           0x00
        bFormatType             1
        bmFormats          0x00000001
          PCM
        bNrChannels             2
        bmChannelConfig    0x00000000
        iChannelNames          12 Out 1
      AudioStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bSubslotSize            4
        bBitResolution         24
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        AudioStreaming Endpoint Descriptor:
          bLength                 8
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bmControls           0x00
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0008
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              5 M2 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              5 M2 
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink          22
        bmControls           0x00
        bFormatType             1
        bmFormats          0x00000001
          PCM
        bNrChannels             2
        bmChannelConfig    0x00000000
        iChannelNames          14 In 1
      AudioStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bSubslotSize            4
        bBitResolution         24
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes           37
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Implicit feedback Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        AudioStreaming Endpoint Descriptor:
          bLength                 8
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bmControls           0x00
          bLockDelayUnits         2 Decoded PCM samples
          wLockDelay         0x0008
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0009
        bInCollection           1
        baInterfaceNr(0)        1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0041
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 2
        iJack                  11 MOTU MIDI In
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 3
        bNrInputPins            1
        baSourceID( 0)          2
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 4
        bNrInputPins            1
        baSourceID( 0)          1
        BaSourcePin( 0)         1
        iJack                  10 MOTU MIDI Out
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       1
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       3
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        5
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      4 
      bInterfaceProtocol      1 
      iInterface              0 
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  bNumConfigurations      1
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0000
  (Bus Powered)
Comment 4 Alexander Tsoy 2020-03-30 17:12:56 UTC
So, M2 also needs implicit feedback quirk and implicit feedback support needs to be fixed in the driver. Or we are going to choose what is more important: glitch-free playback or a working duplex in pulseaudio.
Comment 5 Alexander Tsoy 2020-03-30 17:16:30 UTC
And this is basically the same bug as bug #103751
Comment 6 Erwin Burema 2020-03-30 17:34:01 UTC
(In reply to Alexander Tsoy from comment #4)
> So, M2 also needs implicit feedback quirk and implicit feedback support
> needs to be fixed in the driver. Or we are going to choose what is more
> important: glitch-free playback or a working duplex in pulseaudio.

Currently running with the workaround and have heard no glitches yet, is there any particular situation those should be prevalent?

Also as far as I have been able to test Jack is still able to do full duplex audio even with the implicit feedback quirk enabled, as I understand this is because Jack opens the device differently. So if pulse can figure out if this quirk is enabled for the device it should be able to work around it (by opening the device the same way Jack does instead of doing whatever is does now)

Am I wrong here?
Comment 7 Alexander Tsoy 2020-03-30 17:52:50 UTC
(In reply to Erwin Burema from comment #6)
> (In reply to Alexander Tsoy from comment #4)
> > So, M2 also needs implicit feedback quirk and implicit feedback support
> > needs to be fixed in the driver. Or we are going to choose what is more
> > important: glitch-free playback or a working duplex in pulseaudio.
> 
> Currently running with the workaround and have heard no glitches yet, is
> there any particular situation those should be prevalent?

This probably depends on how system clock diverges from the devices' internal clock. If you record a sine wave from M2, you will see periodic artifacts.

> Also as far as I have been able to test Jack is still able to do full duplex
> audio even with the implicit feedback quirk enabled, as I understand this is
> because Jack opens the device differently. So if pulse can figure out if
> this quirk is enabled for the device it should be able to work around it (by
> opening the device the same way Jack does instead of doing whatever is does
> now)

Yes, this depends on the order in which an application configures and starts pcm streams. But it would be better if it gets fixed on the kernel side.
Comment 8 Erwin Burema 2020-03-30 18:14:51 UTC
(In reply to Alexander Tsoy from comment #7)
> (In reply to Erwin Burema from comment #6)
> > (In reply to Alexander Tsoy from comment #4)
> > > So, M2 also needs implicit feedback quirk and implicit feedback support
> > > needs to be fixed in the driver. Or we are going to choose what is more
> > > important: glitch-free playback or a working duplex in pulseaudio.
> > 
> > Currently running with the workaround and have heard no glitches yet, is
> > there any particular situation those should be prevalent?
> 
> This probably depends on how system clock diverges from the devices'
> internal clock. If you record a sine wave from M2, you will see periodic
> artifacts.
> 

Just checked with a 1Khz sine and every few seconds there is a slight plop, it is noticeable with a pure tone but not very noticeable in day to day use.

> > Also as far as I have been able to test Jack is still able to do full
> duplex
> > audio even with the implicit feedback quirk enabled, as I understand this
> is
> > because Jack opens the device differently. So if pulse can figure out if
> > this quirk is enabled for the device it should be able to work around it
> (by
> > opening the device the same way Jack does instead of doing whatever is does
> > now)
> 
> Yes, this depends on the order in which an application configures and starts
> pcm streams. But it would be better if it gets fixed on the kernel side.

That would be preferable and will be able to test patches
Comment 9 Erwin Burema 2020-04-03 13:07:10 UTC
Created attachment 288179 [details]
patch to enable duplex usb audio whith implicit feedback

This patch enables duplex audio for me with implicit feedback and should still fail when:
 1) Endpoint already in use but not used for implicit feedback
 2) Endpoint used as implicit feedback but configured with different parameters

This is based on my understanding that when implicit feedback is used the output stream uses the input stream to check sync (so for 1 output packet 1 input packet), but those packets can still also be used for an actual input audio stream. Of course this only works when settings don't change (settings for both input and output endpoint need to be the same)

The current check is I think overly complicated and duplicates quite a bit of code but not sure what checks should be performed to make sure input and output stay the same.
Comment 10 Takashi Iwai 2020-05-07 15:13:10 UTC
The patch looks good and feasible, could you submit it alsa-devel ML?
Maybe better to brush up the coding style issues via checkpatch.pl before submitting, though.
Comment 11 Jelmer Vernooij 2020-05-07 15:32:34 UTC
FWIW I've been running with the patch for the last week or so with a M2 and various other audio devices, with no issues encountered.
Comment 12 Erwin Burema 2020-05-07 15:35:08 UTC
Will clean up the patch and send it to alsa-devel coming weekend
Comment 13 Luke Tidd 2020-06-15 19:33:05 UTC
Thanks all, especially Erwin for the work on this. I am also running a patched 5.6.12 and my MOTU M2 is functional.
Comment 14 Alexander Tsoy 2020-06-16 08:48:28 UTC
Well, AFAIS, it actually doesn't fully fix the issue. If you, for example, start/stop capture stream while playback stream is active, then playback will be interrupted. We really need to always start and stop both endpoints at the same time with some refcounting of substreams.
Comment 15 Takashi Iwai 2020-06-16 10:52:50 UTC
(In reply to Alexander Tsoy from comment #14)
> Well, AFAIS, it actually doesn't fully fix the issue. If you, for example,
> start/stop capture stream while playback stream is active, then playback
> will be interrupted.

Does it even after applying the recent full-duplex support on 5.8?  The endpoint is managed with refcount, so the sync EP should be still running after the capture stream gets closed before the playback, I thought.
Comment 16 Alexander Tsoy 2020-06-16 11:42:54 UTC
Hmm.. I need to retest with the more recent kernel.
Comment 17 Takashi Iwai 2020-06-16 12:07:36 UTC
There might be something overlooked, of course :)
e.g. I didn't track fully how the sync ep handling in snd_usb_handle_sync_urb() can be influenced.

And there is one potential use-after-free, which I already showed a fix patch in the past.  I'll submit the oneliner soon later.
Comment 18 Erwin Burema 2020-06-16 17:30:45 UTC
(In reply to Alexander Tsoy from comment #16)
> Hmm.. I need to retest with the more recent kernel.

If you can find something I'll see if I can get some kind of fix for it during the weekend.
Comment 19 fanantoxa 2020-07-13 12:37:55 UTC
Hi everyone.

I just got my Motu M2 recently and trying to use it under Ubuntu.

Still have some issues
Full-duplex doesn't work with pulseaudio

Kernel 5.7.8
Kernelt 5.8-rc5

If I switch to use M2 input it just stop output
In addition anything that were using it start to hand
For example if I had chrome playing video on youtube:
 - First sound disappear but video still going
 - After player showed me all that was cached it hangs
   Like should that loading circle but it doesn't load anything
 - If I open new video same issue it show circle and can't kinda start it at all

If I swatch PulseAudio to user other input and after disconnect/connect Motu and restart chrome everything works again as usual.

Also I've tried JACK config from this guide:
https://panther.kapsi.fi/posts/2020-02-02_motu_m4

It did worked out but I had only JACK in my sound setting (witch is not what I'm up too since I also use other sound deviced)
But it did worked out.

Problem happen when you disconnect/connect Motu.

(I have USB hub that I switch from PC <-> Laptop, This is crucial for me since I do it few time a day)

The same can be emulated by just turning Motu off/on (likely it have switch on the back)

So with JACK it was working but If I connect/disconnect it stop working.
And I experience same issue that I described above (with chrome)
In this case only restart helps to get control back.


If that will be somehow helpful for investigation.

Also I'm can provide other information like logs or smth (but please help me with that, I don't know where to look)
Comment 20 Luke Tidd 2020-07-21 14:15:02 UTC
If anyone needs someone to test a patch, I can. Let me know if there are any types of tests I could run.
Comment 21 fanantoxa 2020-07-29 21:52:05 UTC
(In reply to Luke Tidd from comment #20)
> If anyone needs someone to test a patch, I can. Let me know if there are any
> types of tests I could run.

It a patch in comment #9
> attachment 288179 [details]

I wasn't able to build a kernel with it yet. But we can try to test it probably.
Comment 22 Luke Tidd 2020-07-30 02:44:02 UTC
Oh that patch, yes I tested it and things seemed fine for me. I can test again if people want, I thought it wasn't going in because it needed more work.
Comment 23 fanantoxa 2020-07-30 18:44:33 UTC
Created attachment 290697 [details]
fix-pulseaudio-for-motu-m2.patch
Comment 24 fanantoxa 2020-07-30 18:45:07 UTC
I've tried to build a Ubuntu Kernel to apply this patch.

But I've found that changes already there.

https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.7.11/


It still doesn't work with pulseaudio.



I was looking to comment here:

> The issue seems to be introduced with commit:
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/sound/usb/pcm.c?h=v5.4.28&id=da2d50868e59257410fe75315dc99984c3b9fad6
> which is a fix for the MOTU M4 which sadly has the same USB device numbers,
> removing this fix restores duplex mode with the MOTU M2 in pulseaudio

MOTU M2 and M$ have different `iProduct` value

MOTU M4 lsusb -v
https://gist.github.com/puleglot/ec75ff504b8727096c2de7c1a630864a

MOTU M2 lsusb Higer above here in comment #3

I ended up with a patch:
https://bugzilla.kernel.org/attachment.cgi?id=290697



I didn't try it yet. But will do this weekend.
I have hard time to build Ubuntu Kernel, but will try my best.

If you'd be able to test it before it'd be nice.
Comment 25 Erwin Burema 2020-07-30 19:00:32 UTC
(In reply to fanantoxa from comment #24)
> I've tried to build a Ubuntu Kernel to apply this patch.
> 
> But I've found that changes already there.
> 
> https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.7.11/
> 
> 
> It still doesn't work with pulseaudio.
> 

That is really weird since it works for me under pulse audio (and many other people using implicit feedback devices) maybe related to the power issue I described bellow?

> 
> 
> I was looking to comment here:
> 
> > The issue seems to be introduced with commit:
> >
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/sound/usb/pcm.c?h=v5.4.28&id=da2d50868e59257410fe75315dc99984c3b9fad6
> > which is a fix for the MOTU M4 which sadly has the same USB device numbers,
> > removing this fix restores duplex mode with the MOTU M2 in pulseaudio
> 
> MOTU M2 and M$ have different `iProduct` value
> 
> MOTU M4 lsusb -v
> https://gist.github.com/puleglot/ec75ff504b8727096c2de7c1a630864a
> 
> MOTU M2 lsusb Higer above here in comment #3
> 
> I ended up with a patch:
> https://bugzilla.kernel.org/attachment.cgi?id=290697
> 
> 
> 
> I didn't try it yet. But will do this weekend.
> I have hard time to build Ubuntu Kernel, but will try my best.
> 
> If you'd be able to test it before it'd be nice.

That will disable implicit feedback making duplex audio work but making sync fail (eventually) you will be experiencing small pops every few seconds when recording. 

That said the following rings a bell (forgot about it since I "solved" it well before the initial implicit feedback patch in 5.5 or 5.6)

> If I switch to use M2 input it just stop output
> In addition anything that were using it start to hand
> For example if I had chrome playing video on youtube:
>  - First sound disappear but video still going
>  - After player showed me all that was cached it hangs
>    Like should that loading circle but it doesn't load anything
>  - If I open new video same issue it show circle and can't kinda start it at
>  > > all

It is an USB powermanagement issue which can be worked around with the following udev rule:

ATTRS{idVendor}=="07fd", ATTRS{idProduct}=="0008", ATTR{power/control}="on", ATTR{power/persist}="0"

and also poweroff the M2 (with the switch on the back) when suspending the computer and power on when resuming. Extremely rarely it still fails but it seems to be firmware related.
Comment 26 fanantoxa 2020-07-30 20:40:39 UTC
(In reply to Erwin Burema from comment #25)


I'll try to get some help. I've tried this rule.
And looks like I have some other problems.

When I switch input to MOTU, output stuck. But actually I don't even get input.
Nothing incoming.

Maybe I messed up some configs (it was many config changes to try make it work.)
Probably I've broke something. (And I still on Ubuntu 18.04 but with 5.7 kernel which also might make a difference).

I probably start with making bootable flash with 20.04 to make a fast test
Comment 27 fanantoxa 2020-08-02 19:16:54 UTC
So I partly made I work.

I won't able to test properly on 20.04 yet.
( I need to find a way how to make bootable flash drive with custom kernel version)

But when I boot on 20.04 (with 5.4.0.40 kernel) and I choose M2 as an Input it automatically switches output to other device (laptop speackers in my case).

So Input worked but no duplex.

On Ubuntu 18.04 it don't do that switch for me just stuck.

Also I kinda managed it to work on my current Ubuntu 18.04

I've update pulseaudio manually from 11.0 to 13.0 (Ubuntu don't have it yet in repo's)

Now when I chose `Analog Output - M2` and after `Analog Input - M2` both works!!!!
I was able to make some recording while playing music.

But once I've finished recording I switched `Analog Input` to another device (Logitech webcam in my case)

Both output stuck and applications that where using it.

So audacity not able to perform recording (it just doesn't do anything when I click on play)
Firefox hangs like chrome did.

If I go to sound settings (in gnome) and click on other output device and back to M2 it starts to work again.


So some things are works some bugs are still there.


I'll try more to check what happening. Next step will be:
- check some logs in Ubuntu 18.04
- make bootable Ubuntu 20.04 with 5.7.11 kernel
Comment 28 fanantoxa 2020-08-28 00:07:29 UTC
So I've tried more.

I manage to use JACK + PulseAudio. And it works good.
(I didn't get yep how to make JACK ocupate only MOTU and not other devices, but it's minor and should be doable)

But if I disconnect and connect back (or on/off) device.
If hang browser as usual.
In addition to that it brakes JACK too.

So I'm getting no devices to output audio and can't input. But WebCam mic still seen in pulseaudio and works properly.

```
03:05:08.786 D-BUS: JACK server could not be started. Sorry
Fri Aug 28 03:05:08 2020: Starting jack server...
Fri Aug 28 03:05:08 2020: ERROR: `default' server already active
Fri Aug 28 03:05:08 2020: ERROR: Failed to open server
Fri Aug 28 03:05:10 2020: Saving settings to "~/.config/jack/conf.xml" ...
03:05:18.361 Could not connect to JACK server as client. - Overall operation failed. - Server communication error. Please check the messages window for more info.
```
Comment 29 Luke Tidd 2020-08-28 03:11:45 UTC
I used 5.9 rc1 or rc2 over the weekend and simultaneous playback and recording was possible without starting JACK. The details are over my head as I can't find out what implicit feedback means, but I am curious what the current state of the code in the kernel is? Are there outstanding issues I might expect? It seems to be working pretty nicely.
Comment 30 fanantoxa 2020-08-28 10:12:46 UTC
(In reply to Luke Tidd from comment #29)
> I used 5.9 rc1 or rc2 over the weekend and simultaneous playback and
> recording was possible without starting JACK. The details are over my head
> as I can't find out what implicit feedback means, but I am curious what the
> current state of the code in the kernel is? Are there outstanding issues I
> might expect? It seems to be working pretty nicely.

I can't use 5.9 rc1|2 because it unstable yet and breaks other stuff I use in linux.

Maybe will try when it will be 5.9.0


I manage to work it few time with pulseaudio and JACK.
But main problem that no metter what you use if I turn Off/On device while Laptop os running it hang everythinig.

Could you try off and on device while OS is running and you have both input/output as motu?
Comment 31 fanantoxa 2020-08-28 10:26:46 UTC
Ok. I've reset all the configs to default, reinstalled pulseaudio and removed JACK.

Now I got both input and output working.

But still when I turn off and on device it hangs.
I managed to get off this hang state without restarting chrome:
- changed input to another device (WebCam in my case)
- turn off and on motu again
- got to output setting and click to internal speakers and back for a few times.


Also if there were no sound for some long time and I start to some video, there is no sound for ~5 second and after it starts.
Comment 32 fanantoxa 2020-08-28 10:33:53 UTC
I addition to Steps to make it work:

After those steps I'm able Only working output.
If I try to use input at the same time it hangs as usual.

Repeating those step make output work again.
Comment 33 Erwin Burema 2020-08-28 14:20:27 UTC
First things first if you have duplex audio on pulseaudio than the patch discussed here (and this bug) is solved. For some background implicit feedback in USB means that it uses the input channel(s) for timing feedback on the output channels it does so by looking at packet size (next packet size to send out is the packet size of the last incoming packet), without the patch in this bug report(which should now be mainlined) the Linux USB audio driver didn't want to extract the audio from the input line due to it already being started for use as implicit feedback, with this patch it checks if a) it is used as implicit feedback and b) if it would be set up the same as the output channel, if both are the case it just skips setup and starts using the endpoint. This is the only thing the patch does and shouldn't cause any hangs

I also used to have a lot more audio hangs before applying the following udev rule:

ATTRS{idVendor}=="07fd", ATTRS{idProduct}=="0008", ATTR{power/control}="on", ATTR{power/persist}="0"

Combining what I know about implicit feedback and the above USB rule I don't think the hang us caused by the USB audio stack but a bug in the power management code most likely in the firmware of the M2 (and probably M4 as well)

Ergo you probably should open a new bug report since I am pretty sure it is not related to this one.
Comment 34 Alexander Tsoy 2020-08-28 15:26:26 UTC
(In reply to fanantoxa from comment #31)
> Also if there were no sound for some long time and I start to some video,
> there is no sound for ~5 second and after it starts.
This is probably caused by a sample rate change. And this is a limitation of the device, not a linux bug.
Comment 35 Luke Tidd 2020-08-28 21:50:57 UTC
I don't know what I was thinking; unfortunately I can only access my machine with the updated kernel on the weekend and perhaps I had been drinking. I definitely still need to start JACK to have simultaneous i/o working.

5.9.0-rc2
Comment 36 Luke Tidd 2020-09-12 15:49:27 UTC
Unfortunately I don't see this patch in 5.9-rc4.

Do you think the MOTU M4 would need a different approach? If the strcmp is removed, would this patch support both cards?

I haven't tested recording a sine wave, if it produces artifacts during recording is there any bug about the underlying issue causing that?
Comment 37 Erwin Burema 2020-09-12 16:07:32 UTC
(In reply to Luke Tidd from comment #36)
> Unfortunately I don't see this patch in 5.9-rc4.
> 
> Do you think the MOTU M4 would need a different approach? If the strcmp is
> removed, would this patch support both cards?
> 
> I haven't tested recording a sine wave, if it produces artifacts during
> recording is there any bug about the underlying issue causing that?

Which patch are you using? The implicit feedback patch is included I can clearly see the code that I wrote that was accepted so duplex audio on implicit feedback devices should be working. The strcmp was only to distinguish M2 from M4 which isn't needed since both use implicit feedback.

The artifacts you get are because the timers on the computer and inside the USB audio device are not synced, implicit feedback fixes this by telling the host how much behind or ahead it is by decreasing or increasing the buffers it sends (and the host receives), the host should then use those buffer sizes for the next block it sends back.(this differs from explicit feedback which uses an extra USB endpoint for its feedback, according to apples documentation implicit is more accurate and thus recommended that is probably why so many devices uses it) This has most impact on the playback (made a mistake in an earlier comment when saying recording) which depending on how much out of sync the timers are can be more or less audible (it will always be audible on a pure sine).

(besides implicit and explicit there is also a total async mode that is mostly used in cheaper/older devices since that is the only mode supported by UAC1, UAC2 introduced the feedback modes which allowed USB audio devices to be used in sync modes important for audio production, instead of just as a consumer device)
Comment 38 Luke Tidd 2020-09-12 16:13:29 UTC
I'm sorry I was referring to "fix-pulseaudio-for-motu-m2.patch". We shouldn't expect this to work out of the box until pcm.c get's this diff, correct?
Comment 39 Erwin Burema 2020-09-12 16:58:16 UTC
(In reply to Luke Tidd from comment #38)
> I'm sorry I was referring to "fix-pulseaudio-for-motu-m2.patch". We
> shouldn't expect this to work out of the box until pcm.c get's this diff,
> correct?

No that is not correct, that patch disable implicit feedback on the M2 which it definitely needs. Currently running 5.8.2 with only the patches provided by Arch applied (currently 1 unrelated to USB audio) and have my M2 working in full duplex (under both pulseaudio and jack, probably raw ALSA as well but haven't tried that).
Comment 40 Luke Tidd 2020-09-19 15:44:41 UTC
I see where my confusion has come from. I was running a different kernel than you and I was expecting the same behavior.

kernel 5.8.10-arch1-1:
  Everything appears to work all of the time. I have full duplex audio that functions at when the desktop starts, and I have not experienced any issues yet. I did not use the power related udev rule.

kernel 5.9.0-rc5-1-mainline:
  Often, audio can play for about 20 seconds when the desktop starts, then hangs. Any other application that tries to in or out audio will also hang. If all of these applications are closed, then restarted, full duplex audio can sometimes work. Sometimes it does not start working again and it takes restarting the card to get it to function. I have tried this with and without the udev rule, I do not see a difference. I have tested the same kernel with a Focusrite Scarlett 4i4 and have not reproduced this hang.

I'm not sure if we should expect a release candidate kernel to function correctly, but I wanted to include this here in case it's relevant.
Comment 41 Erwin Burema 2020-09-19 16:53:11 UTC
(In reply to Luke Tidd from comment #40)
> I see where my confusion has come from. I was running a different kernel
> than you and I was expecting the same behavior.
> 
> kernel 5.8.10-arch1-1:
>   Everything appears to work all of the time. I have full duplex audio that
> functions at when the desktop starts, and I have not experienced any issues
> yet. I did not use the power related udev rule.
> 
> kernel 5.9.0-rc5-1-mainline:
>   Often, audio can play for about 20 seconds when the desktop starts, then
> hangs. Any other application that tries to in or out audio will also hang.
> If all of these applications are closed, then restarted, full duplex audio
> can sometimes work. Sometimes it does not start working again and it takes
> restarting the card to get it to function. I have tried this with and
> without the udev rule, I do not see a difference. I have tested the same
> kernel with a Focusrite Scarlett 4i4 and have not reproduced this hang.
> 
> I'm not sure if we should expect a release candidate kernel to function
> correctly, but I wanted to include this here in case it's relevant.

If this is indeed the case you want to git bisect the kernel between 5.8.10 and 5.9.0-rc5 so you can pinpoint a patch that introduces your issues. Am going to see if I have time for this myself, but no guarantees on that front (I am just a hobyist with way to much knowledge, but not a lot of time)

PS. You also might want to try a different USB port, sometimes multiple devices on the same hub don´t  get along.
Comment 42 Luke Tidd 2020-10-08 14:10:16 UTC
Small update, I've removed any other USB devices besides keyboard and mouse and tried different ports, but since this problem is only occurring with the release candidate kernels I am going to assume it's software.

Unfortunately I haven't had time to figure out a workflow to run `git bisect` on this.

I did however try the newly released arch linux-mainline kernel package and the issue is still present in "5.9.0-rc8-1-mainline".
Comment 43 Luke Tidd 2020-10-14 16:19:51 UTC
I realized a simple work around for the issue I am experiencing.

Currently testing with Arch's 5.9.0-1-mainline AUR kernel, but I am seeing a similar problem when I look closely with older kernels.

Problem Details:
On boot:
No sound output
No VU activity on the sound card display for output (the input still responds)
pavucontrol:
  "Playback" tab -> no VU activity on the playing application
  "Output Devices" -> no VU activity which displays only "M Series Analog Stereo" -> "Analog Output" which is selected and not muted
  "Configuration" tab shows "M Series" -> "Analog Stereo Duplex"

Mitigation:
  Either power cycle the sound card or less invasively select the "Configuration" tab of pavucontrol, set "M Series" Profile to "Off", then back to "Analog Stereo Duplex"

After rebooting about 20 times, infrequently the sound card will work and not need the mitigation. If I boot three times in a row and test sound output, the need to do the mitigation is very likely. Can anyone else see this behavior?

I could write a systemd service that tries to restart pulseaudio after the desktop or disable then re-enable the sound card but it seems like a bug somewhere.

Should this be filed as a separate bug?

Note You need to log in before you can comment on or make changes to this bug.