[PATCH 1/5] ASoC: aw88261: fix sign bit check in aw88261_dev_get_vcalk()

From: Marco Giunta

Date: Thu Nov 19 2026 - 11:30:43 EST


AW88261_EF_ISN_GESLP_SIGN_MASK and AW88261_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.

aw88261_dev_get_icalk() does this correctly:
if (reg_icalk & (~AW88261_EF_ISN_GESLP_SIGN_MASK))

while aw88261_dev_get_vcalk() does not:
if (reg_vcalk & AW88261_EF_VSN_GESLP_SIGN_MASK)

Add the missing negation to fix this. This ensures that the aw88261 driver
behaves like the vendor Android driver it was ported from (aw882xx), and
that it's consistent with the other upstream Awinic drivers that have
analogous functions, i.e. aw88166 and aw88395 (aw88399 has the same bug,
which is fixed in the next patch).

Fixes: 028a2ae25691 ("ASoC: codecs: Add aw88261 amplifier driver")
Signed-off-by: Marco Giunta <marco_giunta@xxxxxxxxxx>
---
Hi everyone,
I'm currently working on an aw88399 patch series targeting some QOL fixes.

While working on this, I spotted some things needing fixes that I'm
sending separately now, as they are all relatively straightforward.

I checked whether the same bugs were present in other awinic drivers
and found a couple of matches, that are included in this series as
well.

Overall:

* patches 1 & 2 fix a missing bitmask inversion in aw88261 and aw88399;
* patches 3 & 4 fix an OR that should be an AND in aw88166 and aw88399;
* patch 5 fixes a forgotten rename from AW883XX to AW88399 in aw88399.

Best regards,
Marco

sound/soc/codecs/aw88261.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/aw88261.c b/sound/soc/codecs/aw88261.c
index e14df93e67f7..d4db919d8a2d 100644
--- a/sound/soc/codecs/aw88261.c
+++ b/sound/soc/codecs/aw88261.c
@@ -306,7 +306,7 @@ static int aw88261_dev_get_vcalk(struct aw_device *aw_dev, int16_t *vcalk)

reg_vcalk = (reg_vcalk >> AW88261_VCALK_SHIFT) & (reg_vcalkl >> AW88261_VCALKL_SHIFT);

- if (reg_vcalk & AW88261_EF_VSN_GESLP_SIGN_MASK)
+ if (reg_vcalk & (~AW88261_EF_VSN_GESLP_SIGN_MASK))
reg_vcalk = reg_vcalk | (~AW88261_EF_VSN_GESLP_NEG);
*vcalk = (int16_t)reg_vcalk;


base-commit: 20a21fd8ba1bb23c907ee5709f9232a9c84710a1
--
2.56.1