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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CEE1EC4332F for ; Tue, 20 Dec 2022 19:32:53 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DF7A818A7; Tue, 20 Dec 2022 20:32:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DF7A818A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671564770; bh=3RH9NpTe5Gc0wAIVorjHbbomvQGBK/9hVXaTLg3w96c=; h=From:Date:Subject:To:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=EbtglELAhR7wn+KQpPcjspQqEudHeZUBvb3F+wHfF2RxH2twFluIpcEKESOdCGqSs LILSPrMblbl9DY3AX1Y3emAdzSdngJeoaAHFDfgs9VKdDyryb7ZkeR8KDL6tkUiz+D YGSuQRM2yGuIV6v4ATz+wW1jRBseDgamw+HzQBcg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1D681F89627; Tue, 20 Dec 2022 20:12:30 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D613EF89627; Tue, 20 Dec 2022 20:12:28 +0100 (CET) Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C6EA5F89623 for ; Tue, 20 Dec 2022 20:12:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C6EA5F89623 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Zx+OZuhh Received: by mail-ej1-x632.google.com with SMTP id tz12so31520788ejc.9 for ; Tue, 20 Dec 2022 11:12:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=3uLa8ajteDiOGAZvhSykFDlJdUftlgnCdSxpkuYzHko=; b=Zx+OZuhheM1p9U2+5vopR71SRR1nxKu4lrkIqgl78Bov1H+HUAB5ZDSXZXs9SVoDj7 24cq+bs5bDjg8AaTEGkcquv01gGswnSfuff+agBK3WZwIQVqUrFOjXbM096BUo399oHe qwTC3aY8jRHk3/9ss84MRIHXCKPkJWjOhne0xJFu5ER1AbMQE32oEU5cljJEvYKhPBbj Yb4kgYttHycaN5q29OtKYRk/W9Y5zM41PT3Eio3ruU9pl2DnQi2ZSzDMWuFHphfnGatK 9dbzXqNmvmylmfvUqsJ7qKHoodkZjeDVjqkzrJxcznSYFaH0h0kSMuEgfr+pZLNn5vvG uBsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3uLa8ajteDiOGAZvhSykFDlJdUftlgnCdSxpkuYzHko=; b=T43AB+E800uOOfFOPYkOzqVs62pfbqQJ5t0Nge379gzQBqOorHUOxMVM7Mph5u02r0 BXe3R5fAFJoJCNKMgtTN2NQy4pep/JWMsEitm0PNxKhZb4LABmYzIY+iXjjpisbMwHJs OzKN5ruykZCygvUJZelSc09MkkDNEMO/zDiJ+W1KGO6+wQuP1x7NYUy3zHrIjxABPh27 lBBlFrZCcIa9ILkWqCX+LuOkxZMHEPte2aiq8E1mgP94adJiiprrsypJ4UTRrOKgQs3E ZsWH1GM85oK9HeKrRu362HUUATvSRTAR2ZgJlx9izukk8fqgtHTYvjfCW7kvpv3Vzo/r lSZw== X-Gm-Message-State: ANoB5pk1PgqgBBBGoLB1ttuLNrq3TVmlMHKiaud1MBpRZfRvVD0nspSX xgJOB07QkWUd6NEQlHe19Q0= X-Google-Smtp-Source: AA0mqf4G42KOa3Ptxy6uvUG11SslfIGCLi/gwTrjGgYou2MlvQJm+h7lZjPCnTVuhdZBPo9vyToY0A== X-Received: by 2002:a17:906:c418:b0:7c1:5768:5fc9 with SMTP id u24-20020a170906c41800b007c157685fc9mr31576004ejz.43.1671563544739; Tue, 20 Dec 2022 11:12:24 -0800 (PST) Received: from [10.0.0.144] (31-10-206-125.static.upc.ch. [31.10.206.125]) by smtp.gmail.com with ESMTPSA id g19-20020a170906539300b007c0efbaa8a0sm6059131ejo.4.2022.12.20.11.12.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Dec 2022 11:12:24 -0800 (PST) From: Emanuele Ghidoli X-Google-Original-From: Emanuele Ghidoli Message-ID: <9657ab8d-0c60-7c81-b1cb-8a5b43d07c40@gmail.com> Date: Tue, 20 Dec 2022 20:12:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: wm8904 and output volume control Content-Language: en-US To: Charles Keepax , Emanuele Ghidoli References: <20221219095846.GC36097@ediswmail.ad.cirrus.com> <20221220100005.GD36097@ediswmail.ad.cirrus.com> In-Reply-To: <20221220100005.GD36097@ediswmail.ad.cirrus.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: alsa-devel@alsa-project.org, Liam Girdwood , Takashi Iwai , Michael Walle , Mark Brown , Francesco Dolcini , emanuele.ghidoli@toradex.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On 20/12/2022 11:00, Charles Keepax wrote: > On Mon, Dec 19, 2022 at 04:20:10PM +0100, Emanuele Ghidoli wrote: >> On 19/12/2022 10:58, Charles Keepax wrote: >>> On Sat, Dec 17, 2022 at 12:47:14AM +0100, Emanuele Ghidoli wrote: >> I infer, from datasheet, that volume update is applied in different >> way based on charge pump dynamic vs register control (CP_DYN_PWR bit >> in CLASS_W register): >> "Under Register control, the HPOUTL_VOL, HPOUTR_VOL, LINEOUTL_VOL >> and LINEOUTR_VOL register settings are used to control the charge >> pump mode of operation. >> Under Dynamic control, the audio signal level in the DAC is used to >> control the charge pump mode of operation." >> >> The second sentence do not explain that volume register is still >> considered by the component but likely in a different way. >> >> It is important to note that I trace I2C transactions and, without >> the patch, the CLASS_W register is written JUST after volume update >> registers (with the patch is written before and after). >> >> At this point I have no doubt that we have to update that register >> before writing volume. >> > > Hmm... I think my only concern here is this feels a bit counter > intuitive, the default value is described as "controlled by > volume register settings" and we are saying in that situation the > volume registers don't seem to update properly. That is far from > impossible but I think we should perhaps poke a little more to > make sure we understand the bounds here. I did some more test and I'm not 100% sure of what is going on anymore. > I see that that CP_DYN_PWR bit is disabled when audio is going > through one of the bypass paths. Would you be able to enable one > of the bypass paths and see if you can manually adjust the volume > on the headphone output, with a bypass path active? With the previous change, I tested all the possible combination with one channel from the DAC and the other toggling from DAC to Bypass changing the volume and it's always correct. > Would also perhaps be interesting as a test to completely remove > the write to CP_DYN_PWR from probe and leave things set to manual > and see how the volume behaves then? When I tried to remove any write to this register my modification stopped working. > I guess the interests here are to find out if the SYSCLK is > involved at all. I tested keep the clock always enabled, removing clk_disable_unprepare when going into SND_SOC_BIAS_OFF and it has zero effects. Or did you mean something else? Said all of that, I did one last test, forcing a volume update on the charge pump enable callback, cp_event(), with this and only this modification in everything is working fine. Could it just be as easy as that the volume is applied only when the charge pump is already active? From the datasheet this seems a good explanation: The Charge Pump is enabled by setting the CP_ENA bit. When enabled, the charge pump adjusts the output voltages (CPVOUTP and CPVOUTN). What do you think? Emanuele