From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA951C4361B for ; Thu, 17 Dec 2020 09:51:41 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E07F623603 for ; Thu, 17 Dec 2020 09:51:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E07F623603 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 321461841; Thu, 17 Dec 2020 10:50:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 321461841 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1608198699; bh=EjG3uivtOxgP7eqI9n1C8d/LSVP4K3kpHSLq9s59svw=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=S5MpXc1Wl5QnVaHe9jbgAOROsFwyAi0dXImZ/npngD49G0E9jrKuTXcjVVbhcRQV/ FrYwSxz2vYIwdQBSZqi3Jw3JodOJXYE8eTGFUHNhyMFiTrpEyt/0xBnDYM1syvUomQ qWbOmTbqY5zKUZNl411Nm36yGyX2Te+N+eXO74rQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B6EE6F800C7; Thu, 17 Dec 2020 10:50:48 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1F1DEF80260; Thu, 17 Dec 2020 10:50:47 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 23FF4F8014B for ; Thu, 17 Dec 2020 10:50:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 23FF4F8014B X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B4665AC90; Thu, 17 Dec 2020 09:50:40 +0000 (UTC) Date: Thu, 17 Dec 2020 10:50:40 +0100 Message-ID: From: Takashi Iwai To: Marco Giunta Subject: Re: [PATCH] Fix mic sound on Jieli webcam In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org, tiwai@suse.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" On Tue, 15 Dec 2020 10:44:45 +0100, Marco Giunta wrote: > > Hi, > recently I've bought a usb webcam with integrated mic: > > Jieli Technology USB PHY 2.0 (1224:2a25) > > The video part works well, but the mic sound is speedups, "like > minions" (cit.). When I connect the camera, these are the dmesg > messages: > > kernel: usb 1-8: current rate 0 is different from the runtime rate 8000 > kernel: usb 1-8: current rate 0 is different from the runtime rate 16000 > kernel: usb 1-8: current rate 0 is different from the runtime rate 44100 > kernel: usb 1-8: current rate 0 is different from the runtime rate 48000 > kernel: usb 1-8: Warning! Unlikely big volume range (=4096), cval->res > is probably wrong. > kernel: usb 1-8: [3] FU [Mic Capture Volume] ch = 1, val = 0/4096/1 > kernel: usbcore: registered new interface driver snd-usb-audio > > and after a while, dmesg log is filled, every 5 seconds, with: > > kernel: retire_capture_urb: 84 callbacks suppressed > kernel: retire_capture_urb: 1714 callbacks suppressed > > A guy reports on ArchLinux bug website the same problem > (https://bugs.archlinux.org/task/68141?opened=12995&status%5B0%5D=) > and provides a patch to fix the sound issue. I've applied the patch on > kernel 5.9.13 (Fedora 33 x86_64) and now the mic works, no more > minions voice effect. Now dmesg messages are only: > > kernel: usb 1-8: Warning! Unlikely big volume range (=4096), cval->res > is probably wrong. > kernel: usb 1-8: [3] FU [Mic Capture Volume] ch = 1, val = 0/4096/1 > kernel: usbcore: registered new interface driver snd-usb-audio > > the retire_capture_urb messages are gone. > > All credits for the patch go to him but I don't know how to contact > that guy nor I don't know if he has already contacted you, so my > question is if you could review his patch and finally apply upstream. > > If you need other information or you need a tester, I'm here. Thanks for the patch. The still remaining warnings are about the mixer, and your patch doesn't touch about it. You may apply the similar change in volume_control_quirks() like other webcams. And now about the patch: > --- a/sound/usb/format.c 2020-10-01 18:36:35.000000000 +0300 > +++ b/sound/usb/format.c 2020-10-04 02:10:21.678685952 +0300 > @@ -217,6 +217,21 @@ > (chip->usb_id == USB_ID(0x041e, 0x4064) || > chip->usb_id == USB_ID(0x041e, 0x4068))) > rate = 8000; > + > + // hack for "Jieli Technology USB PHY 2.0" webcam > + if (chip->usb_id == USB_ID(0x1224, 0x2a25)) { > + switch (rate) { > + case 8000: > + fp->datainterval += 4; > + break; > + case 16000: > + fp->datainterval += 3; > + break; > + default: > + fp->datainterval += 1; > + break; > + } > + } Modifying datainterval at this point doesn't look intuitive. What's the original datainterval value for those altsettings? The value is retrieved in snd_usb_parse_datainterval() in helper.c, and if any, the correction there would be more sensible. > fp->rate_table[fp->nr_rates] = rate; > if (!fp->rate_min || rate < fp->rate_min) > --- a/sound/usb/endpoint.c 2020-10-01 18:36:35.000000000 +0300 > +++ b/sound/usb/endpoint.c 2020-10-04 02:09:09.471978982 +0300 > @@ -882,6 +882,8 @@ > if (snd_usb_get_speed(ep->chip->dev) != USB_SPEED_FULL) { > packs_per_ms = 8 >> ep->datainterval; > max_packs_per_urb = MAX_PACKS_HS; > + if (!packs_per_ms) > + packs_per_ms = 1; This rather indicates that the datainterval is somehow wrong. > } else { > packs_per_ms = 1; > max_packs_per_urb = MAX_PACKS; > --- a/sound/usb/quirks.c 2020-10-01 18:36:35.000000000 +0300 > +++ b/sound/usb/quirks.c 2020-10-04 02:14:04.532196519 +0300 > @@ -1516,6 +1516,7 @@ > case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */ > case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */ > case USB_ID(0x2912, 0x30c8): /* Audioengine D1 */ > + case USB_ID(0x1224, 0x2a25): /* Jieli Technology USB PHY 2.0 */ > return true; > } This looks fine. thanks, Takashi