Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp934096rdb; Fri, 19 Jan 2024 03:27:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0p+hrmXqofTB3IxHZH2SGMD/usTqHMvShGJjONhHZo6a6P8ltB97BBxO+BCijwc1iNDME X-Received: by 2002:a17:90a:1041:b0:290:2405:aee7 with SMTP id y1-20020a17090a104100b002902405aee7mr1240080pjd.11.1705663652784; Fri, 19 Jan 2024 03:27:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705663652; cv=pass; d=google.com; s=arc-20160816; b=J4fUU2d7jHICIbHl9plfzyCTj4AWEidACJnfCpL/WpzSxZQ9BHRgkXb/RK8Lvn3jZA 8nDMQDsjvvOqAAGt2tdTqIVDQVWjwDIiUVjaTgadUN7tkG7P3JgD44et1tiWQKdqmsFl O9vxM6p5lOOg3QgRohGaEz27KxkfUD1YvT4Pc4w1iiF1PxdSR1aW/Jne8c3PN3ltY36V SpBNuRDhKZ/EgYzvsqWXbKJurd7ZNj362j67Qyk83RqDYJzR6GynSI2c8Qe/Ijd/NvgR rrv+BtB6902buv2j6kNBL262Jcx3AVHPShD7JcH2vgv+BakoO/hjgtSBiLdD4W/gOEF0 UuAA== 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=+tD8xx6wnRasw0MDbT+SJ5aPXuP6QPNhTnjqoHY1NgA=; fh=KBIhiGdu1Ygtr3M+FTFcsBcOHAnQgw4Q3/a7frwkCBE=; b=QPlNUKpj00LIXgSfLLZxCf68yYo7E1obzJ8khxjPOAvzMg8ka/R2duHpZzNSdVNoRN 2eTCmeP+BH6QkfEkYwtoxAFU56mTp97MvLm2/hXJauodPPOypTA3DO/B3HSkKQSHCkek 0mY+tgJk30lutUjH7po0ZGCa4n6YcZ69Fj9Oaf5zh+ZAGHyhVJw4DLdclvs92U06UrUL FYfhA9TXnDTs24/9cUFClifBinwbVp5QdJay0xiWEtrBOwH4U5jJ3m62j4Ipp6hLvll6 n3mp4heJQHivliR0VLzYTK9pVHQBNR5m2LNKYntJlbnmuY9lUIIdMT/6p8GfHldcFqZG JAAQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ADbkUCsi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-31091-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31091-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id qa5-20020a17090b4fc500b0028e63298234si3253855pjb.46.2024.01.19.03.27.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:27:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31091-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ADbkUCsi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-31091-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31091-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6CFD62856CA for ; Fri, 19 Jan 2024 11:27:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6DBF73C6BF; Fri, 19 Jan 2024 11:26:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ADbkUCsi" 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 8C56A4CB4E; Fri, 19 Jan 2024 11:26:55 +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=1705663615; cv=none; b=TfJA7haXPBhD+etezCZd4WFqblZ1Rdbpj1AeigbNp4t9o0LSFs2/iaP2WmK1PedyVybe38ABdAkPYPP4sXVwMaJ+qH+80MQBIG871DKIgZ+FYTNHiRDj4QUX8EKnbl3ekS+hEcFisGfwnJFFEGUftl1l828STzyFWjd2///mDqI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705663615; c=relaxed/simple; bh=7FAxMSZYO+6rp+32a2jHSpUGNLMh3wVgFHZWk8Irimk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kopNSqpsbRQVKqzQS8YrWf+VAjeCHvP29naXntVFNq22+qRbjvrgBZpjeiUC5wn3OfU+4T+0KxsMF2BZPXrMFsooqbEjyqPdfuCMEIpiFBRehxRAj6qvGgz0fgWFJLvgPPGS87cDCWFNphzNWIepUjJTgNte0d+azLzEpq954LI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ADbkUCsi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2516BC43390; Fri, 19 Jan 2024 11:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705663615; bh=7FAxMSZYO+6rp+32a2jHSpUGNLMh3wVgFHZWk8Irimk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ADbkUCsi+gQ1V2GpTItDg1bSvrT+UDjAIdH8Caif9AX6/QklxHnXtFj9V2PwLYXrN +rr++YYQLjOVEmSPlmRA9YRO6tzcsJSjuQ0rJZCQNybWvQIApMUyAtE3YcWFLuXJ1i 46VSQHXGXxM9/0uy577nOpXGEIvfTGnpNHUpEmYboHUSo97p3DfJMyt09cXmfwMNMb qvCp3h2J48QXN3oUyaP2Xwej7iF8R+QDzI3MgXJ0oopYKRzmNbETZJXHAoaCnI7ZDX YRLoZkRih5NxYqvH0qec6PIJzE+/Ra6OnWNQLjJXT27wS15etRRROmLfOXSvZmQLNi yPoKG/ATmo8VQ== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rQn1b-0001xJ-2g; Fri, 19 Jan 2024 12:27:03 +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 v4 1/4] ASoC: codecs: wsa883x: fix PA volume control Date: Fri, 19 Jan 2024 12:24:17 +0100 Message-ID: <20240119112420.7446-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240119112420.7446-1-johan+linaro@kernel.org> References: <20240119112420.7446-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.41.0