From patchwork Thu Oct 9 21:00:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 5061131 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3282E9F30B for ; Thu, 9 Oct 2014 21:00:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 69C4520260 for ; Thu, 9 Oct 2014 21:00:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 350932025B for ; Thu, 9 Oct 2014 21:00:42 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C1EA826044F; Thu, 9 Oct 2014 23:00:35 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 3C69626044F; Thu, 9 Oct 2014 23:00:25 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 370F226045C; Thu, 9 Oct 2014 23:00:24 +0200 (CEST) Received: from mail-pd0-f201.google.com (mail-pd0-f201.google.com [209.85.192.201]) by alsa0.perex.cz (Postfix) with ESMTP id E743526044D for ; Thu, 9 Oct 2014 23:00:14 +0200 (CEST) Received: by mail-pd0-f201.google.com with SMTP id y10so126349pdj.0 for ; Thu, 09 Oct 2014 14:00:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9sJyKbjDUL23WeoTNuSA8oCM4vRV6/hLIpQn8PXVucg=; b=hTJrYWlXFW4UkV3XKBVsxrmbhTlxSSrCOjwIenq8DQAD2PyizbvYUJBuXmO+P4JN5a DTkIQsc0Fk8u1f4KGV+nwSgoLAaBHBkVETZyJQd3EwM0kUqo8sU/G+lyiB0rS+h3V9XI q+Bp6BQovTON2MHGy+32GzWVOBDBcGlbFJrmb+RnQbGPXjkD7DtFriqmsiTyfWt9UinK 4hjDK2sNRVoV1OSWrkIsljXPNqnEXwrHEfnURkvQo7fyMUxqt6WCWhwPiTY9pf4rrWFE P533rL99ZdSKDUak14MUwCSX00NNaBUVxM4WPmcBXO789yhSsVafgexJ/Dbc4c3PZ+8y sMgA== X-Gm-Message-State: ALoCoQkqk5hQ9cRHxpWNHtuYc6FrZLsKwS0PHkiLYFuDwY2ozl/iEpe0ajSj9UroYBJnfDc8laB2w/2Q26KzKfS/w6P7Wf1yaR3kCrIjGE6mS8/Gb3jW2JFE+Hm19w3EEDOjUoeSXWUIMYKhmAs7VExVpwM8vGHYHVAx+FOkL5jwGwnK4oIlOv0= X-Received: by 10.68.175.65 with SMTP id by1mr532833pbc.0.1412888412980; Thu, 09 Oct 2014 14:00:12 -0700 (PDT) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id n22si225601yhd.1.2014.10.09.14.00.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Oct 2014 14:00:12 -0700 (PDT) Received: from hojo20.mtv.corp.google.com ([172.22.65.103]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id yBtpGfEw.1; Thu, 09 Oct 2014 14:00:12 -0700 Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id E499D1C293B; Thu, 9 Oct 2014 14:00:11 -0700 (PDT) From: Dylan Reid To: alsa-devel@alsa-project.org Date: Thu, 9 Oct 2014 14:00:09 -0700 Message-Id: <1412888409-4650-1-git-send-email-dgreid@chromium.org> X-Mailer: git-send-email 2.1.2.330.g565301e Cc: oder_chiou@realtek.com, anatol.pomozov@gmail.com, tiwai@suse.de, benzh@chromium.org, broonie@kernel.org, Dylan Reid Subject: [alsa-devel] [PATCH] ASoC: rt5677: make volume TLV closer to reality X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The volume blocks have an step of 0.375dB, but TLV uses 0.01dB for units. Approximate 0.375 as 0.37. It leaves the minimum value off by 1.15dB, but that is better than being off by ~500 as it was with 37.5 as the step. Signed-off-by: Dylan Reid --- Just a suggestion. It seems to me to be the lesser of two evils. This probably won't be the last codec that has a higher resolution than 0.01dB, should we come up with a way to express that? --- sound/soc/codecs/rt5677.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 16aa4d9..f139d5a 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -538,9 +538,11 @@ static bool rt5677_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); +/* Actual min=-65.625dB and step=0.375dB but only have 0.01 resolution. */ +static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6475, 37, 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); +/* Actual min=-17.625dB and step=0.375dB but only have 0.01 resolution. */ +static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -1739, 37, 0); static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); static const DECLARE_TLV_DB_SCALE(st_vol_tlv, -4650, 150, 0);