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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB1BCC54E58 for ; Fri, 15 Mar 2024 17:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J7NAVWEsH6mFAOUugAuTIWcukmrmSlmBVOJ2LjhpkTo=; b=0YCKjoHCysec/l 95H3ufWRBLHRkbDTl8nn/kBhhnyufoL5EWGxyweNLnod9aeRWAidJoX5n98Iph/ZeizJiApNF28AS eUxcOOX/7B6H0czuNFi3Ifvdmd8WkirtLKvUMScQ+HenXLIksfP0AcqBJmPOZx/PWaFhZjtp96MPD IKd/RlhdqL1e8ztxH3KJRzjXuUpVaxlKIkMI5nP/YNGwBs3lEVaVeKNog58NPUWJfTF4lrWEVnqR2 WrFd7tt3R4simtzJUl8PBFqEdgulhyk6XPikJWbem1qct796BDbjrYCNtq2Xxixb7BhGJ6rifD/hr zeECPIIYOyGm2R2Uudwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rlBTu-000000012HG-0pU6; Fri, 15 Mar 2024 17:36:34 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rlBTl-000000012DX-145R for linux-arm-kernel@lists.infradead.org; Fri, 15 Mar 2024 17:36:30 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2d2505352e6so26814481fa.3 for ; Fri, 15 Mar 2024 10:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1710524183; x=1711128983; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4ec9RrIuQWFrWDmIdusRv4/vXGJuKnTeszoS+IpWRfc=; b=vev4n1HM8Rh3QV0se3zIq0CUTiSaiipkWnw5yrOak/oXcotcagJZT3Sxp7oHPKvuXy USawNspv5Pj+OPege1nkjJQG0EmqQ9QZor5ylWcX5N/NLCIVG7NEyoIbx72hbLDp2pby ODUxtkx+Tkn0oVszh39592xb2DXGK2sS/NX9fLsWnp+qNzRO+5G8tqo/WYZYudqFe4+r Do9vbNykcz0N9iUX8bYEeldhEDSNEvqm65GensxDR2rD8z7GoHOuBRdrFoenIAl38Kgd Y15K+gvEaD4Hn4yqW0XkaT65g/3IVvalxUtzscNCjZckTU2pz6nCHNVdqzz3GaAnrQkP OwAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710524183; x=1711128983; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4ec9RrIuQWFrWDmIdusRv4/vXGJuKnTeszoS+IpWRfc=; b=Z3C2q8Dp4Ae2ZCRt0Bg2zvJatwiR/vYGVV65I4ZMV0SJMvh+qa8yCzAxPLi8rh02Sk oaZsaFwI+uLtMzpg2gJDDve7A5iV8sCxBIJvMYvEUvNeDSFmcRoBC51bvWrNlJPT173A AzGq0qXk0eIuOSLgn8r9kNp+hzed/CKLwpZtiErQiUQ1cUReDPkWCiUOsVH4JR1T2isF SXd7IP4vUbMxFlxJfvd9Lh141LygOkWYFE7/37a2c/Qf15ROr8zhik/sbcJDWs40TStZ dfDw9wJcpdcn7BbxglsMM5PA72RnGHlb1DGmPJCag2IjnvzA5ToUQVDRLaTEeZm0ZBJB iPeQ== X-Forwarded-Encrypted: i=1; AJvYcCVE8mtl8+eFfvV/NHZ1+D2LQxtnWoK/oiBEi9W3CPvY/eCUbzQkjF2Z+3BzIA7fJO7U9ZpeELXfEbcsGcm7cC2kPJ5Tlt7JTcMr9rxA8sQnE/P7E9E= X-Gm-Message-State: AOJu0YzaEHtPb5ck2UzkaQ+d5MHzgfhsjW46rig45H/qZo6ONz/NqV3L oEVAIy3b2+mQtBCNFhBJabVi3YQ1jpFHj3LSq4MQKWgFQ58D4q+v/It0tY+bSK8= X-Google-Smtp-Source: AGHT+IFk5NGPtCj8mXhvsYrdH1nre5XfSVGVRBDeRwQi7zLXGNIq4CodW9FczpHV1YSFYg82SuoADQ== X-Received: by 2002:a05:651c:23a:b0:2d3:3b37:db78 with SMTP id z26-20020a05651c023a00b002d33b37db78mr3420227ljn.16.1710524182477; Fri, 15 Mar 2024 10:36:22 -0700 (PDT) Received: from [192.168.1.172] ([93.5.22.158]) by smtp.gmail.com with ESMTPSA id ca18-20020a170906a3d200b00a469ebf37dfsm46312ejb.203.2024.03.15.10.36.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Mar 2024 10:36:21 -0700 (PDT) Message-ID: Date: Fri, 15 Mar 2024 18:36:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 12/18] ASoC: codecs: mt6357: add MT6357 codec Content-Language: en-US To: Mark Brown Cc: Liam Girdwood , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Lee Jones , Flora Fu , Jaroslav Kysela , Takashi Iwai , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Catalin Marinas , Will Deacon , linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Nicolas Belin References: <20240226-audio-i350-v1-0-4fa1cea1667f@baylibre.com> <20240226-audio-i350-v1-12-4fa1cea1667f@baylibre.com> <9891855d-2284-42e4-9d3a-35ba406540e8@sirena.org.uk> <0d31ffb2-9df5-4c3e-a728-902b71a1a713@sirena.org.uk> <0a41b498-5cca-4487-a0e0-0df749f6e796@sirena.org.uk> From: Alexandre Mergnat In-Reply-To: <0a41b498-5cca-4487-a0e0-0df749f6e796@sirena.org.uk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240315_103625_667513_C316C467 X-CRM114-Status: GOOD ( 29.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 15/03/2024 16:15, Mark Brown wrote: > On Fri, Mar 15, 2024 at 04:05:21PM +0100, Alexandre Mergnat wrote: >> On 15/03/2024 15:30, Mark Brown wrote: > >>>> Let me know, when you change de gain to do a ramp down (start from user gain >>>> to gain=-40db), next time for the ramp up, how/where do you find the user >>>> gain ? > >>> In the register. You only need to reset the gain to -40dB at the start >>> of the ramp. > >> Sorry but I don't understand your logic, I'm not able to implement it... >> If I'm at -10dB and doing a ramp to reach -40dB, next time I will read the >> register the value will be -40dB. > > After we've done the ramp and turned the amplifier off we can just > restore the desired value? The hardware is not going to care what the > volume is while it's not enabled. If you do that, HP will be enabled at the saved gain, and after that you will do the ramp. To avoid pop, the driver should be rewrite to: Read gain in the reg and save it locally Set -40dB in the reg Enable HP Do ramp And for the shutdown: Read gain in the reg and save it locally Do ramp Disable HP Set saved gain in the reg To resume, that add 4 more steps to save 2 integers into the driver structure. IMHO, I don't think it make the code more readable or optimized, but I don't have a strong opinion about that, so if you think it's better, I will change it. > >> This implementation is also done in other MTK audio codec drivers. > > Perhaps they should be updated too? > >>>> When microphone isn't capturing, the gain read back from the register is >>>> 0dB. I've put some logs in my code and do capture to show how it works: > >>> Is this a property of the hardware or a property of your driver? > >> At the end of the capture, the gain is set to 0dB by the driver. >> At the start of the capture, the gain is set to the setup gain. > > So that's a property of the driver then? Yes > >> AFAII from the comment in the code, it's done to avoid the "pop noises". > > Yes, that's the usual reason to ramp gains. Though if you've just > copied the code without checking that it's needed it's possible that > this is something that's been fixed in current hardware. I did the test at 24dB with and without the "pop filter". Isn't big but I ear the pop at the start of the record without the "pop filter". To be clear, the algo/behavior of this code is an implementation based on the 6k+ lines downstream code for this specific audio codec. But the shape/style is based on upstreamed drivers like mt6358.c. -- Regards, Alexandre _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel