From owner-freebsd-arm@freebsd.org Sun Nov 11 12:52:56 2018 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3CAE1103E93 for ; Sun, 11 Nov 2018 12:52:55 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53AA17FBEF for ; Sun, 11 Nov 2018 12:52:55 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [178.17.145.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 14FC62600F1; Sun, 11 Nov 2018 13:52:48 +0100 (CET) Subject: Re: Raspberry PI 2B/3 and USB audio To: "Herbert J. Skuhra" , freebsd-arm@freebsd.org References: <87ftw96uq0.wl-herbert@gojira.at> From: Hans Petter Selasky Message-ID: <6beca923-ba25-3814-6bb2-f4cc2d7360d3@selasky.org> Date: Sun, 11 Nov 2018 13:52:14 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.0.1 MIME-Version: 1.0 In-Reply-To: <87ftw96uq0.wl-herbert@gojira.at> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 53AA17FBEF X-Spamd-Result: default: False [-4.85 / 200.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: mail.turbocat.net]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; IP_SCORE(-1.58)[ipnet: 88.99.0.0/16(-4.86), asn: 24940(-3.00), country: DE(-0.02)]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Nov 2018 12:52:56 -0000 On 11/10/18 12:24 PM, Herbert J. Skuhra wrote: > Hi, > > if you use an USB sound card on your Raspberry PI 2B/3, can you please > answer the following questions: > > - which USB sound card? > - do you have bad audio on current or stable/12 after r339388? > > My "Creative Technology Ltd Sound Blaster Play 2" device sounds very > bad. Meanwhile more changes were commited but they don't fix audio > completly. > Hi, Some background: The USB controller in Raspberry PI is running HIGH-speed USB. Many USB audio device are FULL-speed USB. In order for a FULL-speed USB device to work in a HIGH-speed USB environment all data transfers need to go through a so-called transaction translator. This transaction translator operate on chunks of data, 171 bytes maximum. That means if a USB audio stream generates 1000 packets per second, then suddenly a bunch of smaller packets will be needed. This puts some stress on the DWC OTG driver and there might be some room for improvement in this area too, but the basic sympthom is that the DWC OTG driver in FreeBSD is not always able to keep up with the timing required for these so-called split transactions. One idea is to move all DWC OTG IRQ handling away from CPU-0. I'm not sure if cpuset supports this yet on armv7 // arm64. Might have to be done in the driver. Further some audio device use non-adaptive clocks, which means the recording channel must be active along with the playback channel else jitter will occur. The recommendation for RPI is a HIGH-speed USB audio device (should be clearly marked in the specification). Using a HIGH-speed USB audio device will reduce the number of interrupts significantly. --HPS