From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-sound@vger.kernel.org, mfd@lists.linux.dev, lee@kernel.org
Subject: Re: [PATCH 2/2] ASoC: cs42l43: Update load detect procedure for cs42l43b
Date: Thu, 12 Nov 2026 11:22:44 +0000 [thread overview]
Message-ID: <avWhhKiOK/DzfdbO@opensource.cirrus.com> (raw)
In-Reply-To: <sashiko-outbox-209438@kernel.org>
On Wed, Nov 11, 2026 at 05:47:46PM +0000, sashiko-bot@kernel.org wrote:
> > + switch (type) {
> > + case CS42L43_TYPE_OMTP:
> > + regmap_write(cs42l43->regmap, CS42L43B_LOAD_DET_SEL, 0x89);
> > + break;
> > + default:
> > + regmap_write(cs42l43->regmap, CS42L43B_LOAD_DET_SEL, 0x98);
> > + break;
> > + }
> > + break;
> > + }
>
> [Severity: Medium]
> Does writing CS42L43B_LOAD_DET_SEL via regmap_write() here and in
> cs42l43_stop_load_detect() cache the register in REGCACHE_MAPLE and cause
> every subsequent regcache_sync() in cs42l43_runtime_resume() to re-write
> it to hardware?
Yeah the register should be marked as readable missed the fact
that overrides precious. Will spin for this.
> > - switch (type & CS42L43_HSDET_TYPE_STS_MASK) {
> > - case 0x0: // CTIA
> > - case 0x1: // OMTP
> > - case 0x4:
> > - return cs42l43_run_load_detect(priv, true);
> > - case 0x2: // 3-pole
> > - return cs42l43_run_load_detect(priv, false);
> > - case 0x3: // Open-circuit
> > + type &= CS42L43_HSDET_TYPE_STS_MASK;
> > +
> > + if (type == CS42L43_TYPE_OPEN)
> > return CS42L43_JACK_EXTENSION;
> > - default:
> > - return -EINVAL;
> > - }
> > + else
> > + return cs42l43_run_load_detect(priv, type);
> > }
>
> [Severity: Medium]
> Does replacing the switch in cs42l43_run_type_detect() cause invalid
> CS42L43_HS_STAT values (0x5..0x7) to be misclassified as a 4-pole headset
> instead of returning -EINVAL?
>
> In cs42l43_run_type_detect(), type is initialized to 0xff and
> regmap_read(cs42l43->regmap, CS42L43_HS_STAT, &type) is not checked for
> errors; if that read fails or hardware reports 0x5..0x7, type &
> CS42L43_HSDET_TYPE_STS_MASK is passed to cs42l43_run_load_detect(), which
> now hits the default branch, enables headset bias and button detection,
> and reports CS42L43_JACK_HEADSET. In addition, the CS42L43_TYPE_OPEN
> cases in cs42l43_start_load_detect() and cs42l43_run_load_detect() are
> unreachable because cs42l43_run_type_detect() returns
> CS42L43_JACK_EXTENSION when type == CS42L43_TYPE_OPEN.
I think we are happy with these, failing the headset detect is
not super useful. And it is safer to handle the open cases
even if at the moment we can't hit those in load detect, load
detect has historically been uses a couple of times to try and
detect what is/when something is connected to an extension cable,
so probably safer against future refactoring.
Thanks,
Charles
prev parent reply other threads:[~2026-11-12 11:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 17:10 [PATCH 0/2] Update cs42l43b load detection proceedure Charles Keepax
2026-11-11 17:10 ` [PATCH 1/2] mfd: cs42l43: Add load detection register needed for cs42l43b Charles Keepax
2026-11-11 17:36 ` sashiko-bot
2026-11-11 17:10 ` [PATCH 2/2] ASoC: cs42l43: Update load detect procedure " Charles Keepax
2026-11-11 17:47 ` sashiko-bot
2026-11-12 11:22 ` Charles Keepax [this message]
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=avWhhKiOK/DzfdbO@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=lee@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mfd@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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