mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marco Giunta <marco_giunta@outlook.it>
To: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	Marco Giunta <marco_giunta@outlook.it>
Subject: [PATCH 2/5] ASoC: aw88399: fix sign bit check in aw88399_dev_get_vcalk()
Date: Thu, 19 Nov 2026 17:30:13 +0100	[thread overview]
Message-ID: <SN6PR19MB23035CADF2988E49E618ADE4FC792@SN6PR19MB2303.namprd19.prod.outlook.com> (raw)
In-Reply-To: <SN6PR19MB2303E8188DC58BDC07645705FC792@SN6PR19MB2303.namprd19.prod.outlook.com>

AW88399_EF_ISN_GESLP_SIGN_MASK and AW88399_EF_VSN_GESLP_SIGN_MASK are
defined with the usual Awinic inverted-mask convention, i.e. they both
equal ~BIT(9); therefore, their negations have to be used to test the
sign bit.

aw88399_dev_get_icalk() does this correctly:
	if (icalk_val & (~AW88399_EF_ISN_GESLP_SIGN_MASK))

while aw88399_dev_get_vcalk() does not:
	if (vcalk_val & AW88399_EF_VSN_GESLP_SIGN_MASK)

Add the missing negation to fix this. This ensures that the aw88399 driver
behaves like the vendor Android driver it was ported from (aw883xx), and
that it's consistent with the other upstream Awinic drivers that have
analogous functions, i.e. aw88166, aw88261, and aw88395.

Fixes: 8ade6cc7e261 ("ASoC: codecs: Add aw88399 amplifier driver")
Signed-off-by: Marco Giunta <marco_giunta@outlook.it>
---
 sound/soc/codecs/aw88399-lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/aw88399-lib.c b/sound/soc/codecs/aw88399-lib.c
index f2e2c88f5ec0..39a752171aa1 100644
--- a/sound/soc/codecs/aw88399-lib.c
+++ b/sound/soc/codecs/aw88399-lib.c
@@ -296,7 +296,7 @@ static int aw88399_dev_get_vcalk(struct aw88399 *aw88399, int16_t *vcalk)
 	else
 		vcalk_val = vcalkh_val | vcalkl_val;
 
-	if (vcalk_val & AW88399_EF_VSN_GESLP_SIGN_MASK)
+	if (vcalk_val & (~AW88399_EF_VSN_GESLP_SIGN_MASK))
 		vcalk_val = vcalk_val | AW88399_EF_VSN_GESLP_SIGN_NEG;
 	*vcalk = (int16_t)vcalk_val;
 
-- 
2.56.1


  reply	other threads:[~2026-11-19 16:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 16:30 [PATCH 1/5] ASoC: aw88261: fix sign bit check in aw88261_dev_get_vcalk() Marco Giunta
2026-11-19 16:30 ` Marco Giunta [this message]
2026-11-19 16:30 ` [PATCH 3/5] ASoC: aw88166: fix clearing of SYSCTRL bits Marco Giunta
2026-11-19 16:30 ` [PATCH 4/5] ASoC: aw88399: " Marco Giunta
2026-11-19 16:30 ` [PATCH 5/5] ASoC: aw88399: rename AW883XX_* macros to AW88399_* Marco Giunta
2026-11-19 16:40 ` [PATCH 1/5] ASoC: aw88261: fix sign bit check in aw88261_dev_get_vcalk() Mark Brown
2026-11-22 22:06 ` Vladyslav Tymoshchuk

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=SN6PR19MB23035CADF2988E49E618ADE4FC792@SN6PR19MB2303.namprd19.prod.outlook.com \
    --to=marco_giunta@outlook.it \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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

all inboxes | Powered by JetHome®