[PATCH 4/5] ASoC: aw88399: fix clearing of SYSCTRL bits
From: Marco Giunta
Date: Thu Nov 19 2026 - 11:31:24 EST
When applying the SYSCTRL value from the firmware,
aw_dev_update_reg_container() means to overwrite the HMUTE, PWDN and DSPBY
bits with fixed values, by clearing them and then taking the OR with the
intended values.
This is the same behavior as the Android driver aw88399 was ported from
(aw883xx), which does so field by field, and as the upstream aw88081,
aw88166, and aw88261 drivers, which manually compute a collective mask and
perform a single VAL &= MASK.
Currently, the aw88399 driver takes the latter approach, by computing MASK
as AW88399_HMUTE_MASK | AW88399_PWDN_MASK | AW88399_DSPBY_MASK.
As per the usual Awinic inverted-mask convention, these macros equal
~BIT(8), ~BIT(0) and ~BIT(2) respectively, so using OR on them yields all
ones and clears nothing.
Use AND instead, as commit b82fa9b0c26e ("ASoC: codecs: aw88261: Fix
erroneous bitmask logic in Awinic init") did for aw88261.
In practice this makes no difference, since the values ORed in right
afterwards equal BIT(8), BIT(0) and BIT(2): these bits end up set
regardless of whether or not they were previously cleared.
The fix here simply keeps the code correct regardless of the values used.
Fixes: 8ade6cc7e261 ("ASoC: codecs: Add aw88399 amplifier driver")
Signed-off-by: Marco Giunta <marco_giunta@xxxxxxxxxx>
---
Alternatively, since the clear is redundant w.r.t. the OR with the *_VALUE
macros, I can add a comment explaining why no clearing is needed and
remove it, if that is preferred.
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 39a752171aa1..447ac5fb01a1 100644
--- a/sound/soc/codecs/aw88399-lib.c
+++ b/sound/soc/codecs/aw88399-lib.c
@@ -957,7 +957,7 @@ static int aw_dev_update_reg_container(struct aw88399 *aw88399,
else
aw_dev->dsp_cfg = AW88399_DEV_DSP_WORK;
- reg_val &= (AW88399_HMUTE_MASK | AW88399_PWDN_MASK |
+ reg_val &= (AW88399_HMUTE_MASK & AW88399_PWDN_MASK &
AW88399_DSPBY_MASK);
reg_val |= (AW88399_HMUTE_ENABLE_VALUE | AW88399_PWDN_POWER_DOWN_VALUE |
AW88399_DSPBY_BYPASS_VALUE);
--
2.56.1