public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>,
	Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>,
	srini@kernel.org, lgirdwood@gmail.com, perex@perex.cz,
	tiwai@suse.com, linux-sound@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH AUTOSEL 7.0-6.12] ASoC: codecs: wcd937x: fix AUX PA sequencing and mixer controls
Date: Tue,  5 May 2026 05:51:32 -0400	[thread overview]
Message-ID: <20260505095149.512052-16-sashal@kernel.org> (raw)
In-Reply-To: <20260505095149.512052-1-sashal@kernel.org>

From: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>

[ Upstream commit 74c876bfd71b1023029a483d7213015201f62b53 ]

Enable AUX PA sequencing during AUX DAC DAPM events and keep the
AUX-specific RX supplies enabled while the path is active.

Add the missing AUX-related mixer controls, including CLSH PA and
DSD left/right switches, so AUX playback can be routed from userspace.

Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260420180221.785113-1-ajay.nandam@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

## Decision Summary
This is a small WCD937x codec fix for an existing AUX playback path. The
verified problem is functional: the AUX path has DAPM routing and
SoundWire channel definitions, but lacks required AUX PA
sequencing/supplies and mixer controls needed for userspace routing.
That can result in broken AUX playback on affected Qualcomm WCD937x
systems.

It is not a security/crash/data-corruption fix, and it does add visible
ALSA mixer controls, which is the main stable-policy concern. On
balance, I would backport it to stable trees that already contain the
WCD937x AUX playback code, especially `v6.12+`; it is small, driver-
local, applies cleanly to `v6.12`, and fixes existing hardware
functionality rather than adding a new driver or subsystem.

## Phase Walkthrough

### Phase 1: Commit Message Forensics
Step 1.1 Record: subsystem `ASoC: codecs: wcd937x`; action verb `fix`;
intent is to fix AUX PA sequencing and missing AUX-related mixer
controls.

Step 1.2 Record: tags found: `Signed-off-by: Ajay Kumar Nandam
<ajay.nandam@oss.qualcomm.com>`, `Link: https://patch.msgid.link/2026042
0180221.785113-1-ajay.nandam@oss.qualcomm.com`, `Signed-off-by: Mark
Brown <broonie@kernel.org>`. No `Fixes:`, `Reported-by:`, `Tested-by:`,
`Reviewed-by:`, or `Cc: stable`.

Step 1.3 Record: message says AUX PA sequencing must be enabled during
AUX DAC DAPM events, AUX-specific RX supplies must stay enabled while
active, and missing CLSH/DSD mixer controls prevent userspace from
routing AUX playback. No crash trace, board name, or kernel version is
stated.

Step 1.4 Record: this is a hidden functional hardware bug fix, not
cleanup. It repairs missing register sequencing and missing routing
controls for an already-present AUX playback path.

### Phase 2: Diff Analysis
Step 2.1 Record: one file, `sound/soc/codecs/wcd937x.c`, `25
insertions`, `1 deletion`. Modified functions/data:
`wcd937x_codec_aux_dac_event()`, `wcd937x_codec_enable_aux_pa()`,
`wcd937x_snd_controls[]`. Scope is single-file, driver-local, surgical.

Step 2.2 Record: `wcd937x_codec_aux_dac_event()` now sets/clears
`WCD937X_AUX_AUXPA` bit 4 with AUX DAC power-up/down.
`wcd937x_codec_enable_aux_pa()` now enables `WCD937X_ANA_RX_SUPPLIES`
bits 6 and 7 after AUX PA power-up and disables them before power-down
completes. `wcd937x_snd_controls[]` gains CLSH/DSD RX SoundWire
switches.

Step 2.3 Record: bug category is hardware sequencing plus
routing/control correctness. The affected path is normal AUX playback,
not an error path, race, memory safety issue, or refcount issue.

Step 2.4 Record: fix is small and easy to audit, but there is a
regression concern: Mark Brown noted in review that disabling RX
supplies in `SND_SOC_DAPM_PRE_PMD` before DAPM disables the PGA is “a
bit weird.” He later applied the patch anyway; no NAK or follow-up
correction was found in the thread.

### Phase 3: Git History Investigation
Step 3.1 Record: blame shows the AUX DAC/PA event code came from
`57fe69db7a015e` (“ASoC: codecs: wcd937x: add playback dapm widgets”),
first contained in `v6.11-rc1`. The base controls came from
`82be8c62a38c6a` (“add basic controls”), also first contained in
`v6.11-rc1`.

Step 3.2 Record: no `Fixes:` tag, so no tagged introducer to follow.
Manual blame identifies the relevant introducers above.

Step 3.3 Record: related history includes `041db4bbe04e8` adding a
missing `LO Switch` control, and `107a5c853eef5` relaxing the AUX PDM
watchdog. The candidate’s context includes the watchdog changes, which
are present from `v6.12`.

Step 3.4 Record: no earlier commits by Ajay Kumar Nandam touching
`sound/soc/codecs` or `wcd937x.c` were found on this branch. The patch
was applied by ASoC maintainer Mark Brown.

Step 3.5 Record: dependencies are the existing WCD937x playback widgets,
controls, SoundWire channel definitions, and for clean context the AUX
watchdog update. It applies cleanly to current `7.0` and to a checked
`v6.12` worktree.

### Phase 4: Mailing List And External Research
Step 4.1 Record: `b4 dig -c 74c876bfd71b` found the original patch at
the patch.msgid.link URL. `b4 dig -a` found only `v1`; no later
revision.

Step 4.2 Record: `b4 dig -w` showed appropriate recipients: Srinivas
Kandagatla, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
`linux-sound`, `linux-arm-msm`, and `linux-kernel`.

Step 4.3 Record: no separate bug report or syzbot/bugzilla link was
present. Web/lore mirror confirmed the only substantive review comment
was Mark Brown’s sequencing concern.

Step 4.4 Record: no multi-patch series was found; this is a standalone
one-patch submission.

Step 4.5 Record: direct lore stable search via `WebFetch` was blocked by
Anubis; web search did not reveal stable-specific discussion for this
exact patch.

### Phase 5: Code Semantic Analysis
Step 5.1 Record: modified functions/data are
`wcd937x_codec_aux_dac_event()`, `wcd937x_codec_enable_aux_pa()`, and
`wcd937x_snd_controls[]`.

Step 5.2 Record: `rg` found both event functions are referenced only by
DAPM widgets: `RDAC4` uses `wcd937x_codec_aux_dac_event()`, and `AUX
PGA` uses `wcd937x_codec_enable_aux_pa()`.

Step 5.3 Record: key callees are `snd_soc_component_update_bits()`,
`wcd937x_rx_clk_enable()`, `wcd_clsh_ctrl_set_state()`, `enable_irq()`,
and `disable_irq_nosync()`. Mixer controls call `wcd937x_get_swr_port()`
/ `wcd937x_set_swr_port()`.

Step 5.4 Record: call chain is userspace ALSA routing/control changes ->
ASoC DAPM powers the AUX route (`IN3_AUX` -> `RX3` -> `RDAC4` ->
`AUX_RDAC` -> `AUX PGA` -> `AUX`) -> the modified DAPM event callbacks
program the codec. The mixer control path updates SoundWire port/channel
masks used later by `wcd937x_sdw_hw_params()` and
`sdw_stream_add_slave()`.

Step 5.5 Record: similar pattern exists in the same driver history:
`041db4bbe04e8` added a missing `LO Switch` for audio playback routing.
`wcd937x-sdw.c` already defines RX channels for `WCD937X_CLSH`,
`WCD937X_DSD_L`, and `WCD937X_DSD_R`, confirming the new controls target
existing channel definitions.

### Phase 6: Stable Tree Analysis
Step 6.1 Record: `v6.1` and `v6.6` do not contain the relevant WCD937x
AUX code. `v6.11` contains the AUX widgets and channel definitions.
`v6.12` contains the watchdog context used by this patch.

Step 6.2 Record: backport difficulty is clean for `v6.12+`; verified by
creating a detached `v6.12` worktree and running `git apply --check`.
For `v6.11`, the patch may need adjustment or prerequisite
`107a5c853eef5`.

Step 6.3 Record: no alternative fix for this exact AUX PA sequencing /
CLSH+DSD control issue was found in current branch history.

### Phase 7: Subsystem And Maintainer Context
Step 7.1 Record: subsystem is ALSA SoC codec driver under
`sound/soc/codecs`; criticality is driver-specific/peripheral, affecting
systems using Qualcomm WCD937x AUX playback.

Step 7.2 Record: WCD937x is active: recent history includes
probe/resource fixes, SoundWire port fixes, OF node leak fixes, and AUX
watchdog fixes.

### Phase 8: Impact And Risk
Step 8.1 Record: affected users are WCD937x codec users with AUX
playback routes.

Step 8.2 Record: trigger is normal AUX playback setup/routing through
ALSA/ASoC; userspace can trigger routing through mixer controls. Exact
affected board population was not verified.

Step 8.3 Record: failure mode is loss of AUX playback/routing, not a
crash or memory-safety bug. Severity is medium for the kernel generally,
high for affected hardware where AUX playback is required.

Step 8.4 Record: benefit is restoring existing hardware functionality on
affected WCD937x systems. Risk is low to medium: the patch is tiny and
driver-local, but adds visible mixer controls and has one noted
sequencing concern.

### Phase 9: Final Synthesis
Step 9.1 Record: evidence for backporting: fixes existing AUX playback
functionality; small single-driver patch; code and channels already
exist; applies cleanly to `v6.12`; reviewed/applied by ASoC maintainer.
Evidence against: no `Reported-by`/`Tested-by`; not a
crash/security/corruption fix; adds new ALSA controls; maintainer raised
a sequencing concern. Unresolved: exact board/user impact and whether
`v6.11` should receive a hand backport.

Step 9.2 Record: stable rules checklist: obviously correct and tested:
mostly yes by code inspection and maintainer application, but no
explicit `Tested-by`; real bug: yes, broken AUX routing/sequencing;
important issue: yes for affected hardware, though not critical system-
wide; small and contained: yes; no new feature/API: borderline because
mixer controls are user-visible, but they expose existing missing route
controls; applies to stable: yes for `v6.12+`, older active trees
without WCD937x AUX code are not applicable.

Step 9.3 Record: exception category: closest match is hardware-specific
driver functionality fix, not a pure device-ID/quirk/build/doc
exception.

Step 9.4 Record: decision is YES for stable trees containing the WCD937x
AUX playback path, especially `v6.12+`. Do not backport to trees where
the driver/path does not exist.

## Verification
- Phase 1: Read candidate commit message and tags from `git show
  74c876bfd71b` and b4-fetched mbox.
- Phase 2: Verified diff stat: one file, `25 insertions`, `1 deletion`.
- Phase 3: Ran `git blame` on AUX DAC, AUX PA, and controls blocks;
  identified `57fe69db7a015e` and `82be8c62a38c6a`.
- Phase 3: Ran `git describe --contains`; WCD937x AUX/control code
  starts in `v6.11-rc1`; watchdog context starts in `v6.12-rc6`.
- Phase 4: Ran `b4 dig -c 74c876bfd71b`, `-a`, and `-w`; found v1-only
  patch and original recipients.
- Phase 4: Fetched lore mirror; confirmed Mark Brown’s review concern
  and later ASoC application.
- Phase 5: Used `rg` and file reads to trace DAPM widget references, AUX
  route, SoundWire channel definitions, and `wcd937x_sdw_hw_params()`.
- Phase 6: Used `git grep` against `v6.1`, `v6.6`, `v6.11`, and `v6.12`;
  verified absence/presence of relevant code.
- Phase 6: Verified `git apply --check` succeeds on current tree and on
  a temporary detached `v6.12` worktree.
- Unverified: exact affected product/board list; no explicit tester or
  reporter was found.

**YES**

 sound/soc/codecs/wcd937x.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c
index 10a2d598caa71..72a53f95d6887 100644
--- a/sound/soc/codecs/wcd937x.c
+++ b/sound/soc/codecs/wcd937x.c
@@ -546,6 +546,9 @@ static int wcd937x_codec_aux_dac_event(struct snd_soc_dapm_widget *w,
 		snd_soc_component_update_bits(component,
 					      WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
 					      BIT(2), BIT(2));
+		snd_soc_component_update_bits(component,
+					      WCD937X_AUX_AUXPA,
+					      BIT(4), BIT(4));
 		snd_soc_component_update_bits(component,
 					      WCD937X_DIGITAL_CDC_DIG_CLK_CTL,
 					      BIT(2), BIT(2));
@@ -562,6 +565,9 @@ static int wcd937x_codec_aux_dac_event(struct snd_soc_dapm_widget *w,
 		snd_soc_component_update_bits(component,
 					      WCD937X_DIGITAL_CDC_ANA_CLK_CTL,
 					      BIT(2), 0x00);
+		snd_soc_component_update_bits(component,
+					      WCD937X_AUX_AUXPA,
+					      BIT(4), 0x00);
 		break;
 	}
 
@@ -730,10 +736,23 @@ static int wcd937x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
 			snd_soc_component_update_bits(component,
 						      WCD937X_ANA_RX_SUPPLIES,
 						      BIT(1), BIT(1));
+		/* Enable AUX PA related RX supplies */
+		snd_soc_component_update_bits(component,
+					      WCD937X_ANA_RX_SUPPLIES,
+					      BIT(6), BIT(6));
+		snd_soc_component_update_bits(component,
+					      WCD937X_ANA_RX_SUPPLIES,
+					      BIT(7), BIT(7));
 		enable_irq(wcd937x->aux_pdm_wd_int);
 		break;
 	case SND_SOC_DAPM_PRE_PMD:
 		disable_irq_nosync(wcd937x->aux_pdm_wd_int);
+		snd_soc_component_update_bits(component,
+					      WCD937X_ANA_RX_SUPPLIES,
+					      BIT(6), 0x00);
+		snd_soc_component_update_bits(component,
+					      WCD937X_ANA_RX_SUPPLIES,
+					      BIT(7), 0x00);
 		break;
 	case SND_SOC_DAPM_POST_PMD:
 		usleep_range(2000, 2010);
@@ -2051,7 +2070,12 @@ static const struct snd_kcontrol_new wcd937x_snd_controls[] = {
 		       wcd937x_get_swr_port, wcd937x_set_swr_port),
 	SOC_SINGLE_EXT("LO Switch", WCD937X_LO, 0, 1, 0,
 		       wcd937x_get_swr_port, wcd937x_set_swr_port),
-
+	SOC_SINGLE_EXT("CLSH PA Switch", WCD937X_CLSH, 0, 1, 0,
+		       wcd937x_get_swr_port, wcd937x_set_swr_port),
+	SOC_SINGLE_EXT("DSD_L Switch", WCD937X_DSD_L, 0, 1, 0,
+		       wcd937x_get_swr_port, wcd937x_set_swr_port),
+	SOC_SINGLE_EXT("DSD_R Switch", WCD937X_DSD_R, 0, 1, 0,
+		       wcd937x_get_swr_port, wcd937x_set_swr_port),
 	SOC_SINGLE_EXT("ADC1 Switch", WCD937X_ADC1, 1, 1, 0,
 		       wcd937x_get_swr_port, wcd937x_set_swr_port),
 	SOC_SINGLE_EXT("ADC2 Switch", WCD937X_ADC2, 1, 1, 0,
-- 
2.53.0


  parent reply	other threads:[~2026-05-05  9:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05  9:51 [PATCH AUTOSEL 7.0-5.10] ALSA: hda: Avoid WARN_ON() for HDMI chmap slot checks Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.1] nvmet-tcp: check INIT_FAILED before nvmet_req_uninit in digest error path Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0] drm/amd/pm: Update emit clock logic Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0] smb: client: change allocation requirements in smb2_compound_op Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.18] btrfs: handle -EAGAIN from btrfs_duplicate_item and refresh stale leaf pointer Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-5.10] nvme: add missing MODULE_ALIAS for fabrics transports Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0] dpll: export __dpll_pin_change_ntf() for use under dpll_lock Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-5.10] nvme-core: fix parameter name in comment Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-5.10] nvme: add quirk NVME_QUIRK_IGNORE_DEV_SUBNQN for 144d:a808 (Samsung PM981/983/970 EVO Plus ) Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0] ASoC: spacemit: move hw constraints from hw_params to startup Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-5.10] ALSA: usb-audio: apply quirk for Playstation PDP Riffmaster Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.18] nvmet-tcp: Don't clear tls_key when freeing sq Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-5.10] rculist: add list_splice_rcu() for private lists Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0] ALSA: hda/realtek: enable mute LED support on ThinkBook 16p Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.18] mailbox: cix: Add IRQF_NO_SUSPEND to mailbox interrupt Sasha Levin
2026-05-05  9:51 ` Sasha Levin [this message]
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.18] btrfs: replace ASSERT with proper error handling in stripe lookup fallback Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-5.10] btrfs: handle unexpected free-space-tree key types Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.18] md/raid5: Fix UAF on IO across the reshape position Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.6] btrfs: apply first key check for readahead when possible Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.6] ASoC: aw88395: Fix kernel panic caused by invalid GPIO error pointer Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.12] nvme-tcp: teardown circular locking fixes Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.18] btrfs: fix wrong min_objectid in btrfs_previous_item() call Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.18] btrfs: check return value of btrfs_partially_delete_raid_extent() Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.18] btrfs: fix raid stripe search missing entries at leaf boundaries Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.18] btrfs: copy devid in btrfs_partially_delete_raid_extent() Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0-6.18] nvme-multipath: put module reference when delayed removal work is canceled Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0] btrfs: abort transaction in do_remap_reloc_trans() on failure Sasha Levin
2026-05-05  9:51 ` [PATCH AUTOSEL 7.0] drm/amdkfd: check if vm ready in svm map and unmap to gpu Sasha Levin

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=20260505095149.512052-16-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=ajay.nandam@oss.qualcomm.com \
    --cc=broonie@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=patches@lists.linux.dev \
    --cc=perex@perex.cz \
    --cc=srini@kernel.org \
    --cc=stable@vger.kernel.org \
    --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