public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
From: Cole Leavitt <cole@unwrap.rs>
To: linux-sound@vger.kernel.org
Cc: ckeepax@opensource.cirrus.com, sbinding@opensource.cirrus.com,
	broonie@kernel.org, patches@opensource.cirrus.com,
	cole@unwrap.rs
Subject: [PATCH] ASoC: cs42l43: Fix headphone volume control overflow at 100%
Date: Wed, 14 Jan 2026 14:38:29 -0700	[thread overview]
Message-ID: <20260114213829.15456-1-cole@unwrap.rs> (raw)

The headphone digital volume control is defined with:
  SOC_DOUBLE_SX_TLV(..., 0x11B, 229, ...)

Where 0x11B (283) is the minimum register value and 229 is the number of
steps. This means the maximum register value is 283 + 229 = 512 (0x200).

However, the register field is only 9 bits wide (mask 0x1FF, max 511).
When the volume is set to 100%, the computed register value of 512
overflows and wraps to 0, causing the volume to suddenly drop to minimum.

Fix by changing the minimum from 0x11B (283) to 0x11A (282), so that:
  282 + 229 = 511 (0x1FF)

This allows 100% volume to work correctly while maintaining the full
229-step range for the -114.50dB to 0dB TLV scale.

Fixes: fc918cbe874e ("ASoC: cs42l43: Add support for the cs42l43")
Signed-off-by: Cole Leavitt <cole@unwrap.rs>
---
 sound/soc/codecs/cs42l43.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
index fd02d8a57e0f..d0c3589d8e1d 100644
--- a/sound/soc/codecs/cs42l43.c
+++ b/sound/soc/codecs/cs42l43.c
@@ -1231,7 +1231,7 @@ static const struct snd_kcontrol_new cs42l43_controls[] = {
 
 	SOC_DOUBLE_SX_TLV("Headphone Digital Volume", CS42L43_HPPATHVOL,
 			  CS42L43_AMP3_PATH_VOL_SHIFT, CS42L43_AMP4_PATH_VOL_SHIFT,
-			  0x11B, 229, cs42l43_headphone_tlv),
+			  0x11A, 229, cs42l43_headphone_tlv),
 
 	SOC_DOUBLE("Headphone Invert Switch", CS42L43_DACCNFG1,
 		   CS42L43_AMP3_INV_SHIFT, CS42L43_AMP4_INV_SHIFT, 1, 0),
-- 
2.52.0


             reply	other threads:[~2026-01-14 21:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-14 21:38 Cole Leavitt [this message]
2026-01-15  9:42 ` [PATCH] ASoC: cs42l43: Fix headphone volume control overflow at 100% Charles Keepax

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260114213829.15456-1-cole@unwrap.rs \
    --to=cole@unwrap.rs \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=sbinding@opensource.cirrus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox