Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp43305rdb; Mon, 22 Jan 2024 11:17:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHFFGHwYvHesWrn7mRMSqqPRbosB1KE0a2Mh6ve9L9o/I9UarGR62GKYCxU6CbKf7t3ao2z X-Received: by 2002:a05:6a20:b927:b0:19b:559a:6835 with SMTP id fe39-20020a056a20b92700b0019b559a6835mr4807237pzb.59.1705951062063; Mon, 22 Jan 2024 11:17:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705951062; cv=pass; d=google.com; s=arc-20160816; b=GH8+eMQNJyVrXOCPGzEfOCstGR84+Vm6lXwLypuRmokcXMCcriA5W4kb08xj10eG28 RwVyDOEKN+en6vjhDrJX3RaXmvC42UmakL0MQVQg7r8l02Jdfj5WcijK5wrDevWaRQjT ApvK/R2Otawy03jl19Io3CobLmJD68U2SDMDfWahw1+yjJptz7I4PWo73PpdVNCLrp0t KIP8G84HXrTxyKCsXLTskqbFlnI1OD5YpKQ5N3RsF1z6RGLd383VirhrGuiNpaKAFCRh EWIavT9doIu4yPkumrvLOV9+eCJzSayemjbY+Paww7hsP712tgDlxSwu2cqoL0xuShQ2 9xeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VjpapzbDS8snzRRB4ewPE2J2r2KttD8SP9U5vk1x9vQ=; fh=KBIhiGdu1Ygtr3M+FTFcsBcOHAnQgw4Q3/a7frwkCBE=; b=ifDdKH5kxGO0z1D5KtSXvYxQbJeNYa4iNFbvE81HhxVT1ZKUfyzWFhUuebA/ZNH5/n riqVDrEVTlCSlKBbZRdXnUS/qX0okurOk6IB4Li9alfYYBYfR6pmEGoKegIYu+Wz9a9U A5ACLXpQjdSby0XOoGQqZTiCH1s8FYU0fuIz0Tys86bp4hnAmhACK9utWg4Qmw9WxyOC ybYx54lZgab5bGKzZ8gcBqE4KJx9xOikEZeYGNXUxMeduXFPrw032/RVOX97uA6Bxlwr frNyvWby8tbR5anmpg+mihkR3JKGRzXU/seL1jKNsKvJG62bTXYoujsk7OdDNamEtD6n ES4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K24fJxSp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33961-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id w20-20020a634914000000b005cfbea76cf8si4538465pga.42.2024.01.22.11.17.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 11:17:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33961-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K24fJxSp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33961-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C7BC0B373B3 for ; Mon, 22 Jan 2024 18:51:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 291AF47F5F; Mon, 22 Jan 2024 18:18:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K24fJxSp" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F1293E490; Mon, 22 Jan 2024 18:18:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705947508; cv=none; b=lmzjaVQXyF1FQyB2+urxmLfdCDdC/2HUK2OOAlzfy1jBHQCo4XhzB04IJrpgSAOXa3zdkZGA7+LJTgmKy8LzYHIuGHAW7kgSwlrbGwgFRFyiWrDbEH5UBp+zpwLXcQgR+1Xbfl96mURCliBTjMZp8Xk0PTOvpymc1Z86nysniHk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705947508; c=relaxed/simple; bh=J3pJykalQ9z5qLyd0IoXv2mhNXbeb8C+rJuQjv479Gs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MSugylEISZxdBjo9oS0CXVKBhF713kZJEFQ/WT42KFxyliX/jOs49XI9aLFlR+Zk+XVpI3gLw05DbyuGnvZFhOZjV2xmoOVq8cTSdxsKzBDi5kfJaJXaEyPxAb5T/lUuFkzGZFPt8WpFZPIfN9tejulzfCO5EcPgMELH2lu7xsY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K24fJxSp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEC71C43399; Mon, 22 Jan 2024 18:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705947507; bh=J3pJykalQ9z5qLyd0IoXv2mhNXbeb8C+rJuQjv479Gs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K24fJxSp+FVgatotrYgfDwSUxsJpUEUirW5i9YYtNy82g7DIQQb8BNKtVxHiXa4Pe WbtgD6zZUdGpU2tphB1q7HqEvldJNHIzfIVA5R6RjTYkHDg4xTQdFzAvTkAx+CUEFf hwbwP2fPqRCrLn1XxDA8XEKKB2eavF044La9klYHiWDFyVANSqK1S+AII7R+G92SbJ KA84JkyVeb5KQdZV1Mz9MEIcHpZg9tzeSCMyk/4P16zr14RMCLe9ylTrFoUgVDzD2c lpakAwNuE/2+uRRsEOFN20SObhp9DBfyjH+n8P8z/rzHIPf9JnlQYmD53TJy4jvHE+ Z9TP1RLO37Chg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rRysa-0000000013T-1ZCx; Mon, 22 Jan 2024 19:18:40 +0100 From: Johan Hovold To: Mark Brown Cc: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH v5 1/4] ASoC: codecs: wsa883x: fix PA volume control Date: Mon, 22 Jan 2024 19:18:16 +0100 Message-ID: <20240122181819.4038-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122181819.4038-1-johan+linaro@kernel.org> References: <20240122181819.4038-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The PA gain can be set in steps of 1.5 dB from -3 dB to 18 dB, that is, in 15 levels. Fix the dB values for the PA volume control as experiments using wsa8835 show that the first 16 levels all map to the same lowest gain while the last three map to the highest gain. These values specifically need to be correct for the sound server to provide proper volume control. Note that level 0 (-3 dB) does not mute the PA so the mute flag should also not be set. Fixes: cdb09e623143 ("ASoC: codecs: wsa883x: add control, dapm widgets and map") Cc: stable@vger.kernel.org # 6.0 Cc: Srinivas Kandagatla Signed-off-by: Johan Hovold --- sound/soc/codecs/wsa883x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c index cb83c569e18d..a2e86ef7d18f 100644 --- a/sound/soc/codecs/wsa883x.c +++ b/sound/soc/codecs/wsa883x.c @@ -1098,7 +1098,11 @@ static int wsa_dev_mode_put(struct snd_kcontrol *kcontrol, return 1; } -static const DECLARE_TLV_DB_SCALE(pa_gain, -300, 150, -300); +static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(pa_gain, + 0, 14, TLV_DB_SCALE_ITEM(-300, 0, 0), + 15, 29, TLV_DB_SCALE_ITEM(-300, 150, 0), + 30, 31, TLV_DB_SCALE_ITEM(1800, 0, 0), +); static int wsa883x_get_swr_port(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) -- 2.43.0