Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp420906rwb; Mon, 28 Nov 2022 23:50:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf7c0FRMR3M9ac99OHzCxSzfpQyEnJoOVRO5zLg1TebgRIFDX1N38o8/X560WMyA46EoXxq/ X-Received: by 2002:a05:6402:4515:b0:461:cf2b:627b with SMTP id ez21-20020a056402451500b00461cf2b627bmr49486860edb.73.1669708212826; Mon, 28 Nov 2022 23:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669708212; cv=none; d=google.com; s=arc-20160816; b=KnqfytoTmGDdfWJHQz54mykEG58K+Hp/yZzwfdsUq2roIhvoada1QD/YDGqPrujGHn rhuaXgVNZnqc+PoFJF047apBJPsJgsALIyCx9K+kr10OLdzlufhT3njEH0QS9T4f69rC EGZNwTZQuByjn3i4puQ+uK0vgXQW1y9YOTdXnwiDJ3cpB/YE2q45uMd1Pw8HF000K/7a DCrfIyBgbAGdOWPsW3pyEKpBi7pN3kvyAy3NE7GSLWptpDVrj56zQOpbKq/mk8Iw2HCo yegrN/3N+AWdWgIS9fQuKqkZzuBMuipldKQb5pDu4yUTXMroS1kePSMOvloBdZCLy27w o4BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=QiMam+oshjx/yNuPlMI/ctZOd3E1xzj79VjC523hfhg=; b=TmjCpWoA673weNDP42eajTcuwTdcN/wIEtqNbaQewZzmoFtXrfjKQHdXzpT+AxOLXB VjVfAqkQTP7stHeywOADEY0AlSkU9D5EhP4jYKyanU19OHPDRFc5svYZqYzL+ZonHiHu ouym9q8M/kdMa6Dt0MBwzXObtqT5h9hX8x+rojDFMOD+lvBI+T++oitrzrPYjVqOfHVp 5mNCWmuxiI0QCSvIOrerUHCInmdgIkVujTkluUDQc+sr9BxlUfw8rwFF5K8TaL+Ulcai IpjZbctzYu5t00dY18kMcPAbfE5OZdcEooQwz+pfRh/aRoIIs1YyW3Z1OM/u6kg1MSop h/rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ZGqZ0RZz; dkim=neutral (no key) header.i=@suse.de header.b=Pp2lRUou; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs10-20020a0564020c4a00b00458bbd3a0d2si11108543edb.602.2022.11.28.23.49.51; Mon, 28 Nov 2022 23:50:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ZGqZ0RZz; dkim=neutral (no key) header.i=@suse.de header.b=Pp2lRUou; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229559AbiK2HOE (ORCPT + 82 others); Tue, 29 Nov 2022 02:14:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229925AbiK2HNq (ORCPT ); Tue, 29 Nov 2022 02:13:46 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B48022AC71 for ; Mon, 28 Nov 2022 23:13:43 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4AE201FDDE; Tue, 29 Nov 2022 07:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669706022; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QiMam+oshjx/yNuPlMI/ctZOd3E1xzj79VjC523hfhg=; b=ZGqZ0RZzvPAzwA0aYaGe9sZJrjavEpcHfsTSG6iURrYBxT5BPbUrh/zAUc7OZHFhOVdjzf zktlqcj44mJNJ72NYM6iztCz2B0SUVu1ErMAfHdwMTfgU84ei9AqISl47vFMUIqxEZpxpp wdewX7E8FoVLDDYMJH2tkYS4NwEW9dA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669706022; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QiMam+oshjx/yNuPlMI/ctZOd3E1xzj79VjC523hfhg=; b=Pp2lRUouRGIydu9M5Uw3wEPduO1qHZZ2bYvoSj+6JDuEGGjFYCySrbWL224ireRAFzp0bV wy7r7iaHpheLZ8DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 176EB13428; Tue, 29 Nov 2022 07:13:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id nVbpBCaxhWMjXQAAMHmgww (envelope-from ); Tue, 29 Nov 2022 07:13:42 +0000 Date: Tue, 29 Nov 2022 08:13:41 +0100 Message-ID: <87h6yiqllm.wl-tiwai@suse.de> From: Takashi Iwai To: John Keeping Cc: alsa-devel@alsa-project.org, Jaroslav Kysela , Takashi Iwai , linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: usb-audio: Add quirk for Tascam Model 12 In-Reply-To: References: <20221128122353.763696-1-john@metanate.com> <87lenvyyp8.wl-tiwai@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 28 Nov 2022 20:20:05 +0100, John Keeping wrote: > > On Mon, Nov 28, 2022 at 02:51:15PM +0100, Takashi Iwai wrote: > > On Mon, 28 Nov 2022 13:23:52 +0100, > > John Keeping wrote: > > > > > > Tascam's Model 12 is a mixer which can also operate as a USB audio > > > interface. The audio interface uses explicit feedback but it seems that > > > it does not correctly handle missing isochronous frames. > > > > > > When injecting an xrun (or doing anything else that pauses the playback > > > stream) the feedback rate climbs (for example, at 44,100Hz nominal, I > > > see a stable rate around 44,099 but xrun injection sees this peak at > > > around 44,135 in most cases) and glitches are heard in the audio stream > > > for several seconds - this is significantly worse than the single glitch > > > expected for an underrun. > > > > > > While the stream does normally recover and the feedback rate returns to > > > a stable value, I have seen some occurrences where this does not happen > > > and the rate continues to increase while no audio is heard from the > > > output. I have not found a solid reproduction for this. > > > > > > This misbehaviour can be avoided by totally resetting the stream state > > > by switching the interface to alt 0 and back before restarting the > > > playback stream. > > > > > > Add a new quirk flag which forces the endpoint and interface to be > > > reconfigured whenever the stream is stopped, and use this for the Tascam > > > Model 12. > > > > > > Signed-off-by: John Keeping > > > > Thanks for the patch, it's an interesting case. > > About the code change: > > > > > --- a/sound/usb/endpoint.c > > > +++ b/sound/usb/endpoint.c > > > @@ -1673,6 +1673,13 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool keep_pending) > > > stop_urbs(ep, false, keep_pending); > > > if (ep->clock_ref) > > > atomic_dec(&ep->clock_ref->locked); > > > + > > > + if (ep->chip->quirk_flags & QUIRK_FLAG_FORCE_IFACE_RESET && > > > + usb_pipeout(ep->pipe)) { > > > + ep->need_setup = true; > > It seems I missed this when forward porting the patch from 5.15 - this > should be setting ep->need_prepare and will change in v2. > > > > + if (ep->iface_ref) > > > + ep->iface_ref->need_setup = true; > > > + } > > > > Is this the forced reset always safe? Imagine that you have > > individual playback and capture streams, and what if only one of them > > gets stopped and restarted while another keeps running? > > I /think/ this is okay because the interfaces for capture & playback are > separate (although the clock is shared). > > There are two endpoints on the playback interface - the playback data > and explicit feedback endpoints - but these are always stopped and > started at the same time so I can't see any problem here. (Only the > data endpoint will trigger the reset request here due to the > usb_pipeout() check.) Ah OK, then it should be safe -- and it'd be worth to mention it in the changelog, too (hint for the resubmission :) Takashi