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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49756EB64DA for ; Fri, 7 Jul 2023 13:48:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232604AbjGGNsC (ORCPT ); Fri, 7 Jul 2023 09:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232736AbjGGNrz (ORCPT ); Fri, 7 Jul 2023 09:47:55 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1E611FE8 for ; Fri, 7 Jul 2023 06:47:49 -0700 (PDT) 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 8783D1FDB4; Fri, 7 Jul 2023 13:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688737668; 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=9ETpM6o6K3HAUc8/fEUMdngpEDYf73Gw3CZHJcQEwIE=; b=1Rvu2ZI3LCC2U75nKNYFIbH1685AZPBZgMhIhXg1JsXZ5hchph7KyuRJLwu10H514uE4cS Fw84dJMAjDd450a7CdXDUeoBg/7zi7CHxKLvJGTo3tHoq/2DxJ/wk5abn7M8hIQUfTmX41 Go9UkGZ7M8IUuFfDZjdqTcEDc8zyuXY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688737668; 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=9ETpM6o6K3HAUc8/fEUMdngpEDYf73Gw3CZHJcQEwIE=; b=rbbizk1mlChErDAs5iKWukmT8SiygTtVQyL5+BgIc4oLm0xvCKpa/BGmfIBYLCwjfRFReM Pznr7h+BGhzALjAg== 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 443501346D; Fri, 7 Jul 2023 13:47:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LrDjD4QXqGQGYgAAMHmgww (envelope-from ); Fri, 07 Jul 2023 13:47:48 +0000 Date: Fri, 07 Jul 2023 15:47:47 +0200 Message-ID: <87v8evkf3w.wl-tiwai@suse.de> From: Takashi Iwai To: Mark Brown Cc: Srinivas Kandagatla , Johan Hovold , perex@perex.cz, tiwai@suse.com, lgirdwood@gmail.com, ckeepax@opensource.cirrus.com, kuninori.morimoto.gx@renesas.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org Subject: Re: [PATCH] ASoC: codecs: wcd938x: fix dB range for HPHL and HPHR In-Reply-To: References: <20230705125723.40464-1-srinivas.kandagatla@linaro.org> <87y1jrkgdx.wl-tiwai@suse.de> <3450ef1e-cb20-4242-b482-41d3d34c4564@sirena.org.uk> <87wmzbkfw7.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 07 Jul 2023 15:35:29 +0200, Mark Brown wrote: > > On Fri, Jul 07, 2023 at 03:30:48PM +0200, Takashi Iwai wrote: > > Mark Brown wrote: > > > > It's moderately common - typically in these cases the control is > > > described in the datasheet as an attenuation control rather than a gain, > > > and this usually corresponds to the physical implementation being only > > > able to make signals smaller relative to the reference. > > > Yeah, I see the use case. The problem is, however, that we're using > > the very same dB info for both gain and attenuation. That means, > > application has no idea how to interpret those dB values -- to be > > added or to be subtracted. > > > We should have defined a new TLV type for attenuation to > > differentiate, and define the TLV macro to give proper min/max. > > The ASoC generic control stuff supports inverting the value prior to > presentation to userspace so it's masked there (instead of writing the > number userspace sees to the register we subtract the number from the > maximum value and write that to the register), pulling that up further > to the ALSA core might be nice I guess? I believe yes. Though, I'm still not sure how we can improve the mismatch of dB min/max. The dB values of those inverted controls reflect the result of subtraction, no? Takashi