The thing though is that I thought xhci(4) was already calling syncmem on that buffer. I mean, it's happening in xhci_device_isoc_start(), isn't it? It's doing
usb_syncmem(&xfer->dmabuf, 0, xfer->length, usbd_xfer_isread(xfer) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); and unless the usbd_xfer_isread() is wrong, it should be passing PREWRITE as well. Unless xfer->length is different than xfer->size? But then the whole isoc code in xhci(4) would be wrong, since it relies on xfer->length. Oh, maybe that's it. The isoc code mostly works on xfer->frlengths[], and maybe xfer->length is not what we need to use there. Maybe we need to sync each individual frame with the corresponding frlength? Patrick Am Mon, May 17, 2021 at 09:08:50PM +0200 schrieb Luca Castagnini: > Hi Alexandre, > > the patch works for me, both with the C-Media and Startech, for both USB2 and > USB3. > > Thanks and best wishes > Luca > > > On 17 May 2021, at 18:44, Alexandre Ratchov <a...@caoua.org> wrote: > > > > On Sat, May 15, 2021 at 04:18:08PM +0000, Doug Moss wrote: > >>> On 11 May 2021, Luca wrote: > >>> Thanks guys. I've ordered one, let's see if I am lucky. > >>> Cheers > >>> Luca > >> I have the same problem: OpenBSD 6.9 arm64, USB audio is not working > >> I wrote before about this, as well as Luca > >> ( https://marc.info/?l=openbsd-arm&m=159691773016835&w=2 ) > >> Thank you to Luca for showing the sndiod logs and kernel messages. > >> To add some further data: > >> I have tried multiple USB audio devices: > >> Logitech S-150 > >> > >> https://www.logitech.com/en-us/products/speakers/s150-usb-stereo-speakers.980-000028.html > >> Schiit Modi > >> https://www.schiit.com/products/modi-1 > >> StarTech as mentioned by other poster in this thread > >> https://www.startech.com/en-us/cards-adapters/icusbaudio2d > >> All work fine on a Powerbook running MacOS, and work fine on OpenBSD 6.9 > >> amd64 > >> All do not work with (OpenBSD 6.9 arm64) on (Raspberry Pi 4 B, rev 1.2) > >> All just create static noise which does seem to have the same envelope as > >> the intended audio (when intended song is quiet, just low level static, > >> then when intended song is louder, the static gets louder) > >> I am particularly perplexed that someone else has gotten the StarTech > >> device to work with OpenBSD arm64. > > > > Hi, > > > > Could you try the diff below? I don't have the hardware to test, this > > is an attempt based on discussion with Luca and other developpers > > > > > > Index: uaudio.c > > =================================================================== > > RCS file: /cvs/src/sys/dev/usb/uaudio.c,v > > retrieving revision 1.160 > > diff -u -p -r1.160 uaudio.c > > --- uaudio.c 11 Jun 2020 16:00:10 -0000 1.160 > > +++ uaudio.c 17 May 2021 16:31:59 -0000 > > @@ -35,6 +35,7 @@ > > #include <dev/usb/usb.h> > > #include <dev/usb/usbdi.h> > > #include <dev/usb/usbdivar.h> > > +#include <dev/usb/usb_mem.h> > > > > #ifdef UAUDIO_DEBUG > > #define DPRINTF(...) \ > > @@ -3173,6 +3174,8 @@ uaudio_pdata_copy(struct uaudio_softc *s > > } > > s->ubuf_pos += count; > > if (s->ubuf_pos == xfer->size) { > > + usb_syncmem(&xfer->usb_xfer->dmabuf, 0, xfer->size, > > + BUS_DMASYNC_PREWRITE); > > s->ubuf_pos = 0; > > #ifdef DIAGNOSTIC > > if (s->ubuf_xfer == s->nxfers) { >