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 3/5] ASoC: aw88166: fix clearing of SYSCTRL bits
Date: Thu, 19 Nov 2026 17:30:14 +0100	[thread overview]
Message-ID: <SN6PR19MB2303CBDAF11DF2405D138159FC792@SN6PR19MB2303.namprd19.prod.outlook.com> (raw)
In-Reply-To: <SN6PR19MB2303E8188DC58BDC07645705FC792@SN6PR19MB2303.namprd19.prod.outlook.com>

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 aw88166 was ported from
(aw883xx), which does so field by field, and as the upstream aw88081
and aw88261 drivers, which manually compute a collective mask and
perform a single VAL &= MASK.

Currently, the aw88166 driver takes the latter approach, by computing MASK
as AW88166_HMUTE_MASK | AW88166_PWDN_MASK | AW88166_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: 94e412c28e61 ("ASoC: codecs: Add aw88166 amplifier driver")
Signed-off-by: Marco Giunta <marco_giunta@outlook.it>
---
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/aw88166.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/aw88166.c b/sound/soc/codecs/aw88166.c
index a520c9089425..226a36f041d9 100644
--- a/sound/soc/codecs/aw88166.c
+++ b/sound/soc/codecs/aw88166.c
@@ -961,7 +961,7 @@ static int aw_dev_update_reg_container(struct aw88166 *aw88166,
 			else
 				aw_dev->dsp_cfg = AW88166_DEV_DSP_WORK;
 
-			reg_val &= (AW88166_HMUTE_MASK | AW88166_PWDN_MASK |
+			reg_val &= (AW88166_HMUTE_MASK & AW88166_PWDN_MASK &
 						AW88166_DSPBY_MASK);
 			reg_val |= (AW88166_HMUTE_ENABLE_VALUE | AW88166_PWDN_POWER_DOWN_VALUE |
 						AW88166_DSPBY_BYPASS_VALUE);
-- 
2.56.1


  parent reply	other threads:[~2026-11-19 16:31 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 ` [PATCH 2/5] ASoC: aw88399: fix sign bit check in aw88399_dev_get_vcalk() Marco Giunta
2026-11-19 16:30 ` Marco Giunta [this message]
2026-11-19 16:30 ` [PATCH 4/5] ASoC: aw88399: fix clearing of SYSCTRL bits 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=SN6PR19MB2303CBDAF11DF2405D138159FC792@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®