Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3097289pxf; Mon, 5 Apr 2021 03:11:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweTFhvD8rIQsdiRRSj1zqUoh/dBQF2WMe6fgZ5p5CnoXKo/Rqp3Lf/a8jL0xFpCdLsIunz X-Received: by 2002:a17:906:a413:: with SMTP id l19mr27744517ejz.421.1617617462550; Mon, 05 Apr 2021 03:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617617462; cv=none; d=google.com; s=arc-20160816; b=HgIcGJ6Jkq1M/6wUqLzZLSMIwKTeqsyJoj7XF6A2MfbwFcVLUlCLoKfN07zOPQSN8e f4DnLylEe5DxV5ebnNA2mltCTL4KDKuJvYlrlnjqWhCYAcj3RJKldCK0fxYGgTax7fMB zAsfG+ONCzmAR8ZC6tm5fh4xxjJpuNPV0EWBEWI6Dj3EVmflUe177PsRhudqTdngKA6J CIM2mUhTzghlGP1GgGSMrN4MUfVxusJrIKrYFY9MMo3x38TBSbELXQ6Xmd5vxlQYeSnh VCSd19plenI34pJ7+GtaJrClnBdQZIzoEGL6QZxc/DXiiTYcgc81HaPGnOgNAN0wqiZM K+tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xqkU9AqkQwRNdKJp3IpMiJ8HFHTlAbISVXq+Z1bikIY=; b=GNnqwUzb2Zc9Goe8yeMUz0LYgSxijZYeeJIBFzuEf2DIkYGDv40CmAFZo3wXGEdF4O CCCl75EFBxHxF+KSSapdunbd3LUGMdM6QxS9HCw+BPAR91jcc1adrkYHfjytrrz9iAOu 07GstckTLsUPxtr4dNzeSAjbUEouSM1b7/27wCw/nk8hd52tC5bIccmXQugprmTQGNND 0GIG+MJ+ijI587QXWqWAqxy5s+KUSn3HZB+AAstlygqAbBCq8liNDT+jV2aMJZx4yIdo 5xyYj6gGoXg5rYymk8ry6CwnIqE6qA/9nX8Z7ttW2wyJsLJmzPWdW4GspaT+QNJZ3lX1 xe0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ov7K+BQD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si268056eds.392.2021.04.05.03.10.39; Mon, 05 Apr 2021 03:11:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ov7K+BQD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232594AbhDEI4g (ORCPT + 99 others); Mon, 5 Apr 2021 04:56:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232478AbhDEI4R (ORCPT ); Mon, 5 Apr 2021 04:56:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ED41061245; Mon, 5 Apr 2021 08:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617612971; bh=rbun0M3lJDr0Fh1Lvg8eOfZVFpFvLk5uRv1RpBIYCLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ov7K+BQD5Qmyt2SnxbBIIgwx7bfGxeeZtI8/pLUBk0XqDxeBjqyFYBmXyQlIE/HYu A1OMIyT7/zRrNzCRVM+d3lFD1y4gjCQNjmsmdloFcgTcqOxPYQvqsfwEwvo0IdTQCv ty9WoytVj/inK3DKChalJ8/Jp/2U/dgggDXBPMec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Mark Brown , Sasha Levin Subject: [PATCH 4.4 05/28] ASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor of 10 Date: Mon, 5 Apr 2021 10:53:39 +0200 Message-Id: <20210405085017.190813334@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210405085017.012074144@linuxfoundation.org> References: <20210405085017.012074144@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit cfa26ed1f9f885c2fd8f53ca492989d1e16d0199 ] The adc_vol_tlv volume-control has a range from -17.625 dB to +30 dB, not -176.25 dB to + 300 dB. This wrong scale is esp. a problem in userspace apps which translate the dB scale to a linear scale. With the logarithmic dB scale being of by a factor of 10 we loose all precision in the lower area of the range when apps translate things to a linear scale. E.g. the 0 dB default, which corresponds with a value of 47 of the 0 - 127 range for the control, would be shown as 0/100 in alsa-mixer. Since the centi-dB values used in the TLV struct cannot represent the 0.375 dB step size used by these controls, change the TLV definition for them to specify a min and max value instead of min + stepsize. Note this mirrors commit 3f31f7d9b540 ("ASoC: rt5670: Fix dac- and adc- vol-tlv values being off by a factor of 10") which made the exact same change to the rt5670 codec driver. Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20210226143817.84287-2-hdegoede@redhat.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/rt5640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index b1c8bb39cdf1..db7734e45dd1 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c @@ -341,9 +341,9 @@ static bool rt5640_readable_register(struct device *dev, unsigned int reg) } static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); -static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); +static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0); static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); -static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); +static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000); static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ -- 2.30.1