stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Srinivas Kandagatla <srini@kernel.org>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 3/4] ASoC: codecs: wsa884x: fix codec initialisation
Date: Fri, 2 Jan 2026 12:43:42 +0100	[thread overview]
Message-ID: <aVevbmfwoHCqrnQF@hovoldconsulting.com> (raw)
In-Reply-To: <18f646c0-00f3-4460-842d-cf8811dddecf@kernel.org>

On Fri, Jan 02, 2026 at 12:31:21PM +0100, Krzysztof Kozlowski wrote:
> On 02/01/2026 12:14, Johan Hovold wrote:
> > The soundwire update_status() callback may be called multiple times with
> > the same ATTACHED status but initialisation should only be done when
> > transitioning from UNATTACHED to ATTACHED.
> > 
> > Fix the inverted hw_init flag which was set to false instead of true
> > after initialisation which defeats its purpose and may result in
> > repeated unnecessary initialisation.
> 
> Either it results or it does not, not "may". 

No, it depends on whether update_status() is called with the same status
more than once. So "may" is correct here.

> If the device moves to
> UNATTACHED state flag should be probably set to "true". This is the bug.

No, update_status() has:

	if (wsa884x->hw_init || status != SDW_SLAVE_ATTACHED)
		return 0;

	...

	wsa884x_init(wsa884x);

so if you set hw_init to true then init is never called when status is
changed to ATTACHED.

> > 
> > Similarly, the initial state of the flag was also inverted so that the
> > codec would only be initialised and brought out of regmap cache only
> > mode if its status first transitions to UNATTACHED.
> 
> Maybe that's confusing wording but existing code was intentional and IMO
> almost correct. The flag is saying - we need hw init - that's why it is
> set to true in the probe and to false AFTER the proper hw initialization
> which is done after ATTACHED state.

All other codec drivers have hw_init mean that init has been done and
the check in update_status() reflects that too so this driver is still
broken.

Johan

  reply	other threads:[~2026-01-02 11:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260102111413.9605-1-johan@kernel.org>
2026-01-02 11:14 ` [PATCH 1/4] ASoC: codecs: wsa883x: fix unnecessary initialisation Johan Hovold
2026-01-05  9:31   ` Krzysztof Kozlowski
2026-01-02 11:14 ` [PATCH 2/4] ASoC: codecs: wsa881x: " Johan Hovold
2026-01-05  9:32   ` Krzysztof Kozlowski
2026-01-02 11:14 ` [PATCH 3/4] ASoC: codecs: wsa884x: fix codec initialisation Johan Hovold
2026-01-02 11:31   ` Krzysztof Kozlowski
2026-01-02 11:43     ` Johan Hovold [this message]
2026-01-02 11:50       ` Krzysztof Kozlowski
2026-01-02 12:17         ` Johan Hovold
2026-01-02 12:26           ` Krzysztof Kozlowski
2026-01-05  9:30   ` Krzysztof Kozlowski

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=aVevbmfwoHCqrnQF@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=broonie@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=srini@kernel.org \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).