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=-5.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 DC86DC433E6 for ; Wed, 17 Mar 2021 02:16:30 +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 7615164F92 for ; Wed, 17 Mar 2021 02:16:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7615164F92 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com 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 19F6018DB; Wed, 17 Mar 2021 03:15:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 19F6018DB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615947387; bh=RNfXoaARjbIXCEw7jrxM5c0TFBmdUtNS0cLzpGFnGe4=; h=Subject:To:References:From:Date:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=fHJNW10XsmBFeLX1MFb1yfD84ImvCd9JuGpvB373FK8fPtTe6fqoyqX6e3PF+gH32 J0qRm9PszEyfIZsV8k3Quts9+vIPUAA38wnLO29Z6zSx4PrsbKuzR/deD+KaR5DnnJ XfVpYooUiwut5Gr+0eQ+oLcdzQTLu5euG8Xmazzc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 48045F801F7; Wed, 17 Mar 2021 03:15:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1E2C8F8021C; Wed, 17 Mar 2021 03:15:35 +0100 (CET) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7D502F8013F for ; Wed, 17 Mar 2021 03:15:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7D502F8013F Received: from [123.112.71.149] (helo=[192.168.0.106]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lMLiW-0004Mr-UY; Wed, 17 Mar 2021 02:15:25 +0000 Subject: Re: [PATCH] ALSA: hda/realtek: add more delay time before determine_headset_type To: Takashi Iwai References: <20210316115549.240014-1-hui.wang@canonical.com> From: Hui Wang Message-ID: Date: Wed, 17 Mar 2021 10:15:17 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Cc: alsa-devel@alsa-project.org, kailang@realtek.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 3/16/21 10:17 PM, Takashi Iwai wrote: > On Tue, 16 Mar 2021 12:55:49 +0100, > Hui Wang wrote: >> We found a recording issue on the headset-mic recently, sometimes >> users plug a headset and select headset-mic from UI, but can't record >> any sound from headset-mic. The root cause is the >> determine_headset_type() returns a wrong type, e.g. users plug a ctia >> type headset, but that function returns omtp type. >> >> In the past, determine_headset_type() worked well because the internal >> mic is connected to the codec, so the "Input Source" or >> "Capture Source" is internal mic by default when users plug a headset, >> the determine_headset_type() will not be called unless users select >> headset-mic from UI, when users select headset-mic, the plugging >> action already finished and the headset is completely plugged into the >> jack, so determine_headset_type() could return a correct type. >> >> But more and more machines connect the internal mic to the PCH now, >> and the "Input Source" is headset mic by default, when users plug a >> headset, the determine_headset_type() will be called immediately, if >> the headset is not completely plugged in, it will return a wrong type. >> >> Here add 2s delay before calling determine_headset_type(), and since >> there is a pop-up dialogue when users do plugging action, to avoid >> freezing the UI, use the deleyed_work to call that function. > Hm, two seconds are quite long, IMHO. How is this delay determined? > > > Takashi Two seconds delay is for a latest Dell AIO machine, and this issue is exposed on that machine. The audio jack is designed to the left side of that AIO machine, users need to use left hand to plug a headset, and since it is an AIO, it is similar to plug sth to the left side on a monitor, users usually don't use the great force to plug otherwise they could introduce the movement of monitor; sometimes they use left hand to plug a headset, the headset is not 100% plugged in, meanwhile they need to put the right hand to the right side of the monitor to fix the monitor. All these actions make the plugging not finished as fast as on laptops or normal desktops. Our QA tested different delays, it has a pretty good chance to return the correct type after adding two seconds delay on that AIO machine. And I guess all Dell AIO machines will face the same issue since they all have multi-function audio jack. And I did a test on some Dell laptops, on which the internal mic connects to the PCH, if I plug the headset a bit slower than normal speed on purpose, the determine_headset_type() has some chance to return the wrong type and make the headset-mic can't record sound. Adding two seconds delay could make them work more stable. Thanks, Hui.