All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas <jaffa225man@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org,
	"Keith A. Milner" <maillist@superlative.org>
Subject: Re: [PATCH] ALSA: usb-audio: Apply implicit feedback mode for BOSS devices
Date: Wed, 21 Apr 2021 23:05:53 -0500	[thread overview]
Message-ID: <CAOsVg8q8KNfaqW0bm90HHUcjqDMCU0etrNY7dhr8TuoMHYZcuA@mail.gmail.com> (raw)
In-Reply-To: <CAOsVg8rCkpBAKkuqUGxt55xGo4D=7RZC_A7CAbQgpG1yLWtHVw@mail.gmail.com>

It does work perfectly now, thanks!

First, I just want to remind you that UA-1000/UA-101 seems enabled in
snd-usb-audio still (or I need to mix that patch with your last), as it
isn't detected for either capture or playback.

Here are the specifics tested:

Roland VG-99 Perfect!:
arecord -D hw:VG99 -f S24_3LE -r 44100 -c 2 ./file.wav
Recording WAVE './file.wav' : Signed 24 bit Little Endian in 3bytes, Rate
44100 Hz, Stereo
^CAborted by signal Interrupt...

aplay -D hw:VG99 -f S24_3LE -r 44100 -c 2 ./file.wav
Playing WAVE './file.wav' : Signed 24 bit Little Endian in 3bytes, Rate
44100 Hz, Stereo


Roland INTEGRA-7 Perfect! (only 96 kHz mode tested):
arecord -D hw:INTEGRA7 -f S32_LE -r 96000 -c 2 ./file.wav
Recording WAVE './file.wav' : Signed 32 bit Little Endian, Rate 96000 Hz,
Stereo
^CAborted by signal Interrupt...

aplay -D hw:INTEGRA7 -f S32_LE -r 96000 -c 2 ./file.wav
Playing WAVE './file.wav' : Signed 32 bit Little Endian, Rate 96000 Hz,
Stereo


Roland R-26 Perfect! (only 96 kHz mode tested):
arecord -D hw:R26AUDIO -f S32_LE -r 96000 -c 2 ./file.wav
Recording WAVE './file.wav' : Signed 32 bit Little Endian, Rate 96000 Hz,
Stereo
^CAborted by signal Interrupt...

aplay -D hw:R26AUDIO -f S32_LE -r 96000 -c 2 ./file.wav
Playing WAVE './file.wav' : Signed 32 bit Little Endian, Rate 96000 Hz,
Stereo


Roland Boutique D-05 Perfect!:
arecord -D hw:Boutique -f S32_LE -r 96000 -c 2 ./file.wav
Recording WAVE './file.wav' : Signed 32 bit Little Endian, Rate 96000 Hz,
Stereo
^CAborted by signal Interrupt...

aplay -D hw:Boutique -f S32_LE -r 96000 -c 2 ./file.wav
Playing WAVE './file.wav' : Signed 32 bit Little Endian, Rate 96000 Hz,
Stereo


EDIROL UA-4FX Perfect! (only tested 48 kHz mode):
arecord -D hw:UA4FX -f S24_3LE -r 48000 -c 2 ./file.wav
Recording WAVE './file.wav' : Signed 24 bit Little Endian in 3bytes, Rate
48000 Hz, Stereo

aplay -D hw:UA4FX -f S24_3LE -r 48000 -c 2 ./file.wav
Playing WAVE './file.wav' : Signed 24 bit Little Endian in 3bytes, Rate
48000 Hz, Stereo


EDIROL UA-25EX Perfect! (only tested 48 kHz mode):
arecord -D hw:UA25EX -f S24_3LE -r 48000 -c 2 ./file.wav
Recording WAVE './file.wav' : Signed 24 bit Little Endian in 3bytes, Rate
48000 Hz, Stereo

aplay -D hw:UA25EX -f S24_3LE -r 48000 -c 2 ./file.wav
Playing WAVE './file.wav' : Signed 24 bit Little Endian in 3bytes, Rate
48000 Hz, Stereo


Unless you decide to simplify it, no improvements seem necessary.
Thanks for your grand achievement, Takahashi!

I really appreciate it!,

  Lucas

On Wed, Apr 21, 2021 at 3:59 AM Takashi Iwai <tiwai@suse.de> wrote:

> Below is a revised patch.  Let me know if this works better.
>>
>>
>> thanks,
>>
>> Takashi
>>
>>
>> --- a/sound/usb/implicit.c
>> +++ b/sound/usb/implicit.c
>> @@ -79,6 +79,7 @@ static const struct snd_usb_implicit_fb_match
>> playback_implicit_fb_quirks[] = {
>>
>>  /* Implicit feedback quirk table for capture: only FIXED type */
>>  static const struct snd_usb_implicit_fb_match
>> capture_implicit_fb_quirks[] = {
>> +#if 0
>>         IMPLICIT_FB_FIXED_DEV(0x0582, 0x00a6, 0x0d, 0x01), /* Roland
>> JUNO-G */
>>         IMPLICIT_FB_FIXED_DEV(0x0582, 0x00a9, 0x0d, 0x01), /* Roland
>> MC-808 */
>>         IMPLICIT_FB_FIXED_DEV(0x0582, 0x00ad, 0x0d, 0x01), /* Roland
>> SH-201 */
>> @@ -146,6 +147,7 @@ static const struct snd_usb_implicit_fb_match
>> capture_implicit_fb_quirks[] = {
>>         IMPLICIT_FB_BOTH_DEV(0x0582, 0x01fd, 0x0d, 0x01), /* Roland
>> Boutique SH-01A */
>>         IMPLICIT_FB_BOTH_DEV(0x0582, 0x01ff, 0x0d, 0x01), /* Roland
>> Boutique D-05 */
>>         IMPLICIT_FB_BOTH_DEV(0x0582, 0x0203, 0x0d, 0x01), /* BOSS AD-10 */
>> +#endif
>>
>>         {} /* terminator */
>>  };
>> @@ -204,30 +206,70 @@ static int add_generic_uac2_implicit_fb(struct
>> snd_usb_audio *chip,
>>                                        ifnum, alts);
>>  }
>>
>> -/* Like the function above, but specific to Roland with vendor class and
>> hack */
>> +static bool roland_sanity_check_iface(struct usb_host_interface *alts)
>> +{
>> +       if (alts->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC ||
>> +           (alts->desc.bInterfaceSubClass != 2 &&
>> +            alts->desc.bInterfaceProtocol != 2) ||
>> +           alts->desc.bNumEndpoints < 1)
>> +               return false;
>> +       return true;
>> +}
>> +
>> +/* Like the UAC2 case above, but specific to Roland with vendor class
>> and hack */
>>  static int add_roland_implicit_fb(struct snd_usb_audio *chip,
>>                                   struct audioformat *fmt,
>> -                                 unsigned int ifnum,
>> -                                 unsigned int altsetting)
>> +                                 struct usb_host_interface *alts)
>>  {
>> -       struct usb_host_interface *alts;
>>         struct usb_endpoint_descriptor *epd;
>>
>> -       alts = snd_usb_get_host_interface(chip, ifnum, altsetting);
>> -       if (!alts)
>> +       if (!roland_sanity_check_iface(alts))
>>                 return 0;
>> -       if (alts->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC ||
>> -           (alts->desc.bInterfaceSubClass != 2 &&
>> -            alts->desc.bInterfaceProtocol != 2) ||
>> -           alts->desc.bNumEndpoints < 1)
>> +       /* only when both streams are with ASYNC type */
>> +       epd = get_endpoint(alts, 0);
>> +       if (!usb_endpoint_is_isoc_out(epd) ||
>> +           (epd->bmAttributes & USB_ENDPOINT_SYNCTYPE) !=
>> USB_ENDPOINT_SYNC_ASYNC)
>> +               return 0;
>> +
>> +       /* check capture EP */
>> +       alts = snd_usb_get_host_interface(chip,
>> +                                         alts->desc.bInterfaceNumber + 1,
>> +                                         alts->desc.bAlternateSetting);
>> +       if (!alts || !roland_sanity_check_iface(alts))
>>                 return 0;
>>         epd = get_endpoint(alts, 0);
>>         if (!usb_endpoint_is_isoc_in(epd) ||
>> -           (epd->bmAttributes & USB_ENDPOINT_USAGE_MASK) !=
>> -                                       USB_ENDPOINT_USAGE_IMPLICIT_FB)
>> +           (epd->bmAttributes & USB_ENDPOINT_SYNCTYPE) !=
>> USB_ENDPOINT_SYNC_ASYNC)
>>                 return 0;
>> +       chip->playback_first = 1;
>>         return add_implicit_fb_sync_ep(chip, fmt, epd->bEndpointAddress,
>> 0,
>> -                                      ifnum, alts);
>> +                                      alts->desc.bInterfaceNumber, alts);
>> +}
>> +
>> +/* capture quirk for Roland device; always full-duplex */
>> +static int add_roland_capture_quirk(struct snd_usb_audio *chip,
>> +                                   struct audioformat *fmt,
>> +                                   struct usb_host_interface *alts)
>> +{
>> +       struct usb_endpoint_descriptor *epd;
>> +
>> +       if (!roland_sanity_check_iface(alts))
>> +               return 0;
>> +       epd = get_endpoint(alts, 0);
>> +       if (!usb_endpoint_is_isoc_in(epd) ||
>> +           (epd->bmAttributes & USB_ENDPOINT_SYNCTYPE) !=
>> USB_ENDPOINT_SYNC_ASYNC)
>> +               return 0;
>> +
>> +       alts = snd_usb_get_host_interface(chip,
>> +                                         alts->desc.bInterfaceNumber - 1,
>> +                                         alts->desc.bAlternateSetting);
>> +       if (!alts || !roland_sanity_check_iface(alts))
>> +               return 0;
>> +       epd = get_endpoint(alts, 0);
>> +       if (!usb_endpoint_is_isoc_out(epd))
>> +               return 0;
>> +       return add_implicit_fb_sync_ep(chip, fmt, epd->bEndpointAddress,
>> 0,
>> +                                      alts->desc.bInterfaceNumber, alts);
>>  }
>>
>>  /* Playback and capture EPs on Pioneer devices share the same
>> iface/altset
>> @@ -365,14 +407,8 @@ static int audioformat_implicit_fb_quirk(struct
>> snd_usb_audio *chip,
>>         }
>>
>>         /* Roland/BOSS implicit feedback with vendor spec class */
>> -       if (attr == USB_ENDPOINT_SYNC_ASYNC &&
>> -           alts->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
>> -           alts->desc.bInterfaceProtocol == 2 &&
>> -           alts->desc.bNumEndpoints == 1 &&
>> -           USB_ID_VENDOR(chip->usb_id) == 0x0582 /* Roland */) {
>> -               if (add_roland_implicit_fb(chip, fmt,
>> -                                          alts->desc.bInterfaceNumber +
>> 1,
>> -                                          alts->desc.bAlternateSetting))
>> +       if (USB_ID_VENDOR(chip->usb_id) == 0x0582) {
>> +               if (add_roland_implicit_fb(chip, fmt, alts) > 0)
>>                         return 1;
>>         }
>>
>> @@ -404,6 +440,13 @@ static int audioformat_capture_quirk(struct
>> snd_usb_audio *chip,
>>         if (p && (p->type == IMPLICIT_FB_FIXED || p->type ==
>> IMPLICIT_FB_BOTH))
>>                 return add_implicit_fb_sync_ep(chip, fmt, p->ep_num, 0,
>>                                                p->iface, NULL);
>> +
>> +       /* Roland/BOSS need full-duplex streams */
>> +       if (USB_ID_VENDOR(chip->usb_id) == 0x0582) {
>> +               if (add_roland_capture_quirk(chip, fmt, alts) > 0)
>> +                       return 1;
>> +       }
>> +
>>         if (is_pioneer_implicit_fb(chip, alts))
>>                 return 1; /* skip the quirk, also don't handle generic
>> sync EP */
>>         return 0;
>>
>

  reply	other threads:[~2021-04-22  4:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  8:32 [PATCH] ALSA: usb-audio: Apply implicit feedback mode for BOSS devices Takashi Iwai
2021-04-14 15:08 ` Mike Oliphant
2021-04-19 13:45   ` Keith A. Milner
2021-04-20  4:20     ` Lucas
2021-04-20 15:42       ` Lucas
2021-04-20 16:36         ` Takashi Iwai
2021-04-21  4:59           ` Lucas
2021-04-21  8:59             ` Takashi Iwai
2021-04-21 16:39               ` Lucas
2021-04-22  4:05                 ` Lucas [this message]
2021-04-22  4:10                   ` Lucas
2021-04-22 12:02                     ` Takashi Iwai
2021-04-22 14:41       ` Keith A. Milner
2021-04-22 15:31         ` Lucas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOsVg8q8KNfaqW0bm90HHUcjqDMCU0etrNY7dhr8TuoMHYZcuA@mail.gmail.com \
    --to=jaffa225man@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=maillist@superlative.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.