From patchwork Thu Dec 14 19:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jens Verwiebe X-Patchwork-Id: 10113121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DA53F60352 for ; Thu, 14 Dec 2017 19:00:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C012329C3A for ; Thu, 14 Dec 2017 19:00:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B491829CF2; Thu, 14 Dec 2017 19:00:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7AD029CF4 for ; Thu, 14 Dec 2017 19:00:16 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id AA7A2266E43; Thu, 14 Dec 2017 20:00:13 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B24C0266E45; Thu, 14 Dec 2017 20:00:11 +0100 (CET) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) by alsa0.perex.cz (Postfix) with ESMTP id 75AAF266E30 for ; Thu, 14 Dec 2017 20:00:08 +0100 (CET) Received: from [192.168.178.21] ([77.186.59.186]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0Lucpk-1f7Nwt2e5Q-00zqLt for ; Thu, 14 Dec 2017 20:00:07 +0100 From: Jens Verwiebe To: alsa-devel@alsa-project.org References: <4d9d4dd7-1b49-574c-ac0b-62fd0e40ba82@jensverwiebe.de> <17555436-4918-0b12-48a6-44c84cc009d2@codethink.co.uk> <8faa629e-b9e0-5124-b9c1-4c5d9678351d@jensverwiebe.de> Message-ID: Date: Thu, 14 Dec 2017 20:00:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <8faa629e-b9e0-5124-b9c1-4c5d9678351d@jensverwiebe.de> Content-Language: en-US X-Provags-ID: V03:K0:zAk4atISUh1VnAjJoyxPqrXlXwuPbHON+CtcORPs2An3JLb5Kw+ 7+eWhvTSTLr6mj3y7ZhDgxXPlLH769cdSw1JfhkyIInn1YTQwmCoPm5P6TM6cwLdojIHg3T WvCcIASN7E7cDCaSWlHjdtT2vfHWzn97UGGqKp4pNNQ1GJWn/6FwdaMop7tpCdfWxZlLymn b1J+uc9TH6hyfNye50lKg== X-UI-Out-Filterresults: notjunk:1; V01:K0:l4ZoG8Xnab4=:Ui6ZG9oFDNkeR1Wg8VXCR0 PYGsTh5uURSqHWuDMi+pjtEoFp5H/37rPVP/rWaYz7jIIKqQ0HHYR9cmA5nkOO9TCWtiq03qB 6kq0BOCpQyHxkMUHb33rkMnzWvagXgq9w7bJnYo72l30VEDaCICvT44UpfX5t3NICaQYYGv44 5x9rvs0yhkKqauCbvOQj7dqXeaFn0q9bp9h+3di/6wzk1XzUEBDkEJn1oaOh/23phFP6OBc/8 v3JEDFc4QPOTxqzqVEp6ql8uvR+XBf92c3RC50NeqjLajrsCe98fWm7hy4v91RjHqLtDPyGVA vSJMRP4Kwi+fQ6jw9HEFfF3rJ/SBZxABIT+ggtpT3ri/eyOVnkUJb/Y6X2v8tu9YMBBswK/Ms lZOGVNfug6hMrGcr7vnLYXfvw4JhmiNBb7zHRxwyQcA2eAJkDUJ9HJ8l7rOfd4Y2+bIGcJBlX 75bDPGly4utDCx6ESdKufsijLqo/yr/AqKFWQ905spXm3nyCgiTJUyEg7EMRmy9nVmmWbTycn fQjrskQFmjYnBTX2U1LKcbzXfTYD6z0Xmi8oma+QBuC9Vdf8Q5ZFGFZM24JQkvHVQAmelkiHw 86fO/srA7EdoSY7RYhCsCmJi64YdAJoYkkwRvRiCzF5zH48sAMrKRrztD0Zap6L/Q2hR/8nnf jQZO22eYpgxayzIhcAMhRoyKuaJEFlrUUApebHB8FLWPqN/9DTjqCgFL6oVSwhnhSeu7wG+Ru uQnTwU+AkRlGh+F0SsuZgJb19Nz5DlCqO9QHGQ== Subject: Re: [alsa-devel] Line6 Helix - usb compliant but not working correct - followup X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, me again In between i got the line6 helix working fine with a hack, which is to set an arbitray rate i have readout from another interface on the same bus. This works reliable so far, no more clicks, no xruns over several hours. There must be som magic to get the true usbrate from this device, but i did no fond a way yet, so my hack is more something unique for my working situation. I also tried to get the implicite feeback from the capture interface to the pb interface to get a proper sync_ep, but still the rate is plain stiff. Another problem is the mixer, which should be a plain passthrough. Cause ctrl interface is somewhat broken pure alsa does not work, but jack can create the device just fine. I attach below the lsusb dump from the helix + my hack and the resulting working proc for further investigation. Any ideas and voodoo is welcome. Cheers ... Jens Am 29.11.2017 um 16:24 schrieb Jens Verwiebe: > Hi,, yeah thx for looking into it. > > TBH i tried all kinda stuff already and also am able to compare all > logs with a Focusrite Scarlett 6i6, which shows > > almost exactly same outputs but works just fine. This makes me clueless. > > I also investigated if this could be a firmware bug, but then it would > not work on osx either, no ? > > Something new i found: if i capture from helix and play this file with > scarlett all is fine. So it seems to be something > with out-of-sync playback only. > > > Am 29.11.2017 um 15:51 schrieb Jorge: >> >> >> On 29/11/17 13:26, Jens Verwiebe wrote: >>> Hi folks >>> >>> I recently got a Line6 Helix LT which can work usb compliant for >>> example on >> >> Interesting. I would like to try the Helix in Linux too. I have seen >> similar issues when fiddling with >> set_sample_rate. Some comments/ideas below. >> >>> >>> OSX or IOS. No driver is needed but the samplerate is fixed to 48000 >>> ( which is okay for the first ). >>> >>> Now i expected this device to work ootb in alsa, which turned out to >>> be half the truth. >>> >>> Connecting the device threw " usb 7-2: >>> parse_audio_format_rates_v2(): unable to retrieve number of sample >>> rates (clock 16)" >>> >>> so i investigated a bit and found this workaround: >>> >>> --- >>> "/media/Workdata3/Development/kernel_lowlat_4.4-97/linux-4.4.97/sound/usb/clock >>> (Kopie).c"    2017-11-08 10:06:31.000000000 +0100 >>> +++ >>> /media/Workdata3/Development/kernel_lowlat_4.4-97/linux-4.4.97/sound/usb/clock.c >>> 2017-11-14 23:06:51.750924051 +0100 >>> @@ -361,6 +361,13 @@ static int set_sample_rate_v2(struct snd >>>      struct uac_clock_source_descriptor *cs_desc; >>> >>>      clock = snd_usb_clock_find_source(chip, fmt->clock, true); >>> +        /* >>> +         * Line6 HELIX does not respond to sample rate >>> +         * set requests. The only valid rate is 48000. >>> +         */ >>> +        if (chip->usb_id == USB_ID(0x0e41, 0x4244) && rate == 48000) >>> +            return 0; >>> + >>>      if (clock < 0) >>>          return clock; >>> >>> --- >>> "/media/Workdata3/Development/kernel_lowlat_4.4-97/linux-4.4.97/sound/usb/format >>> (Kopie).c"    2017-11-08 10:06:31.000000000 +0100 >>> +++ >>> /media/Workdata3/Development/kernel_lowlat_4.4-97/linux-4.4.97/sound/usb/format.c >>> 2017-11-14 23:12:24.329766243 +0100 >>> @@ -293,6 +293,20 @@ static int parse_audio_format_rates_v2(s >>>      int nr_triplets, data_size, ret = 0; >>>      int clock = snd_usb_clock_find_source(chip, fp->clock, false); >>> >>> +    /* >>> +    * Line6 HELIX does not respond to sample rate >>> +    * query requests. The only valid rate is 48000. >>> +    */ >>> +    if (chip->usb_id == USB_ID(0x0e41, 0x4244)) { >>> +        fp->nr_rates = 1; >>> +            fp->rate_min = 48000; >>> +            fp->rate_max = 48000; >>> +            fp->rates = SNDRV_PCM_RATE_48000; >>> +            fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL); >>> +            fp->rate_table[0] = 48000; >>> +            return 0; >>> +        } >>> + >>>      if (clock < 0) { >>>          dev_err(&dev->dev, >>>              "%s(): unable to find clock source (clock %d)\n", >>> >>> >>> This trick made the device appear in aplay -l and /proc/asound just >>> as expected. >>> >>> [ 7988.495085] usb 7-2: new high-speed USB device number 4 using >>> xhci_hcd >>> [ 7988.663622] usb 7-2: New USB device found, idVendor=0e41, >>> idProduct=4244 >>> [ 7988.663625] usb 7-2: New USB device strings: Mfr=1, Product=2, >>> SerialNumber=3 >>> [ 7988.663627] usb 7-2: Product: HELIX >>> [ 7988.663629] usb 7-2: Manufacturer: LINE 6 >>> [ 7988.663630] usb 7-2: SerialNumber:    2744535 >>> >>> But i ended up with sometimes occuring soft clicks in playback which >>> imply i have timing problems. >>> >>> Another symptom is aplay does not output any sound while not >>> throwing any error while in jack i can create the driver just fine. >> >> Have you tried debugging the pointer position with that device? Do >> you get sensible buffer sizes >> with `-v` in aplay for 48KHz, 24 bits, etc? > I get just this but silence ( while plughhw:1,0 == scarlett looks same > and plays sound ): > > aplay -D plughw:6,0 -vv test.wav > Wiedergabe: WAVE 'test.wav' : Signed 16 bit Little Endian, Rate: 44100 > Hz, stereo > Plug PCM: Rate conversion PCM (48000, sformat=S16_LE) > Converter: libspeex (builtin) > Protocol version: 10002 > Its setup is: >   stream       : PLAYBACK >   access       : RW_INTERLEAVED >   format       : S16_LE >   subformat    : STD >   channels     : 2 >   rate         : 44100 >   exact rate   : 44100 (44100/1) >   msbits       : 16 >   buffer_size  : 22050 >   period_size  : 5512 >   period_time  : 125000 >   tstamp_mode  : NONE >   period_step  : 1 >   avail_min    : 5512 >   period_event : 0 >   start_threshold  : 22050 >   stop_threshold   : 22050 >   silence_threshold: 0 >   silence_size : 0 >   boundary     : 6206523236469964800 > Slave: Route conversion PCM (sformat=S32_LE) >   Transformation table: >     0 <- 0 >     1 <- 1 >     2 <- none >     3 <- none >     4 <- none >     5 <- none >     6 <- none >     7 <- none > Its setup is: >   stream       : PLAYBACK >   access       : MMAP_INTERLEAVED >   format       : S16_LE >   subformat    : STD >   channels     : 2 >   rate         : 48000 >   exact rate   : 48000 (48000/1) >   msbits       : 16 >   buffer_size  : 24001 >   period_size  : 6000 >   period_time  : 125000 >   tstamp_mode  : NONE >   period_step  : 1 >   avail_min    : 6000 >   period_event : 0 >   start_threshold  : 24000 >   stop_threshold   : 24001 >   silence_threshold: 0 >   silence_size : 0 >   boundary     : 6755680916032454656 > Slave: Hardware PCM card 6 'HELIX' device 0 subdevice 0 > Its setup is: >   stream       : PLAYBACK >   access       : MMAP_INTERLEAVED >   format       : S32_LE >   subformat    : STD >   channels     : 8 >   rate         : 48000 >   exact rate   : 48000 (48000/1) >   msbits       : 32 >   buffer_size  : 24001 >   period_size  : 6000 >   period_time  : 125000 >   tstamp_mode  : NONE >   period_step  : 1 >   avail_min    : 6000 >   period_event : 0 >   start_threshold  : 24000 >   stop_threshold   : 24001 >   silence_threshold: 0 >   silence_size : 0 >   boundary     : 6755680916032454656 >   appl_ptr     : 0 >   hw_ptr       : 0 > > >> >> I once ended up with really small buffers when I changed the usb >> audioformats for a fixed rate device >> so there was not sound whatsoever even though all the devices were >> present. I am not sure whether >> fp->rates should get SNDRV_PCM_RATE_CONTINUOUS either way and then >> min/max = 48KHz delimiting it. > > Tried this already, makes no difference. >> >> Jorge. >> >>> >>> I would apreciate any hint what i could try out here. >>> >>> >>> Greetings from Hamburg ... Jens >>> >> >> > > My wisdom is at the end here ... Jens ;-) > diff --git a/sound/usb/clock.c b/sound/usb/clock.c index 92e6918..d25986a 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c @@ -373,7 +373,6 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface, if (chip->usb_id == USB_ID(0x0e41, 0x4244) && rate == 48000) return 0; - if (clock < 0) return clock; diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index c90607e..026095a 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -888,6 +888,8 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) ep->freqn = get_usb_full_speed_rate(rate); + else if (USB_ID(0x0e41, 0x4244)) + ep->freqn = get_usb_high_speed_rate(rate + 5); // ugly helix hack, readout from focusrite scarlett on same usbbus else ep->freqn = get_usb_high_speed_rate(rate); diff --git a/sound/usb/format.c b/sound/usb/format.c index 1c0107d..886089f 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -305,7 +305,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, if (chip->usb_id == USB_ID(0x0e41, 0x4244)) { fp->nr_rates = 1; fp->rate_min = 48000; - fp->rate_max = 48000; + fp->rate_max = 48000; fp->rates = SNDRV_PCM_RATE_48000; fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL); fp->rate_table[0] = 48000;