[PATCH 2/5] ASoC: aw88399: fix sign bit check in aw88399_dev_get_vcalk()

From: Marco Giunta

Date: Thu Nov 19 2026 - 11:32:51 EST


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@xxxxxxxxxx>
---
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