[PATCH 1/6] ASoC: aw88166: fix RE value accumulating bits across profile updates
From: Marco Giunta
Date: Thu Nov 26 2026 - 16:29:08 EST
The RE value is 32 bits wide and split across two registers: ACR1 holds
the upper 16 bits and ACR2 the lower 16 bits. aw_dev_update_reg_container()
assembles re_init_val from the profile's ACR1 and ACR2 entries with |=,
without clearing the previous value first. Since the function runs on
every firmware update, e.g. on profile switches and start retries, bits
from earlier values are carried over into the new one.
Clear each half of re_init_val before inserting the new value, so that
the profile's ACR1/ACR2 entries replace the stored halves instead of
being merged into them.
Fixes: 94e412c28e61 ("ASoC: codecs: Add aw88166 amplifier driver")
Signed-off-by: Marco Giunta <marco_giunta@xxxxxxxxxx>
---
sound/soc/codecs/aw88166.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/aw88166.c b/sound/soc/codecs/aw88166.c
index 19436c001a80..b3d11e1b5d67 100644
--- a/sound/soc/codecs/aw88166.c
+++ b/sound/soc/codecs/aw88166.c
@@ -988,12 +988,14 @@ static int aw_dev_update_reg_container(struct aw88166 *aw88166,
}
if (reg_addr == AW88166_ACR1_REG) {
- aw88166->re_init_val |= (uint32_t)reg_val << 16;
+ aw88166->re_init_val = (aw88166->re_init_val & AW88166_CALI_RE_HBITS_MASK) |
+ (uint32_t)reg_val << AW88166_CALI_RE_HBITS_SHIFT;
continue;
}
if (reg_addr == AW88166_ACR2_REG) {
- aw88166->re_init_val |= (uint32_t)reg_val;
+ aw88166->re_init_val = (aw88166->re_init_val & AW88166_CALI_RE_LBITS_MASK) |
+ (uint32_t)reg_val << AW88166_CALI_RE_LBITS_SHIFT;
continue;
}
base-commit: de56305f9c90fbc5d78cbf094e6d1efc252bf835
--
2.56.1