Skip to content

Shikra mbhc - #1323

Open
mohsRafi wants to merge 4 commits into
qualcomm-linux:qcom-6.18.yfrom
mohsRafi:Shikra_mbhc
Open

mohsRafi wants to merge 4 commits into
qualcomm-linux:qcom-6.18.yfrom
mohsRafi:Shikra_mbhc

Conversation

@mohsRafi

Copy link
Copy Markdown
Contributor

Shikra headphone mbhc support support

Enable PM4125 MBHC settings.

CRs-Fixed: 4674032

…perties

The binding already describes qcom,mbhc-buttons-vthreshold-microvolt,
but not the rest of the data the MBHC block needs to detect a 3.5mm
jack, even though wcd_dt_parse_mbhc_data() reads all of it from the
codec node and the schema has unevaluatedProperties set to false. A
board that describes its jack is therefore rejected by the schema.

Document the remaining four properties, matching the descriptions used
for the same properties in qcom,wcd93xx-common.yaml:

 - qcom,hphl-jack-type-normally-closed and
   qcom,ground-jack-type-normally-closed describe the board's jack
   switches. The MBHC logic has to know the idle state of the HPHL and
   ground switches to tell an insertion from a removal.
 - qcom,mbhc-headset-vthreshold-microvolt and
   qcom,mbhc-headphone-vthreshold-microvolt are the ADC thresholds that
   separate a headset from a headphone and a headphone from a floating
   jack. They are board specific because they depend on the jack
   wiring and on the microphone bias voltage they are measured against.

All four stay optional, as they are for the wcd93xx codecs: the driver
derives the thresholds from the microphone bias voltage when they are
absent and assumes normally open switches, so existing device trees
keep working unchanged.

Assisted-by: Claude Opus 5
Link: https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-1-8bc1212db6f7@oss.qualcomm.com/
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
pm4125_mbhc_program_btn_thr() pre-shifts the computed threshold by two
bits before handing it to snd_soc_component_write_field(). That helper
already shifts the value by the number of trailing zeroes of the mask,
so with PM4125_ANA_MBHC_BTN0_THRESHOLD_MASK being GENMASK(7, 2) the
value gets shifted twice.

The two most significant bits of the threshold are shifted out past the
mask and the remaining bits land four times too high, so every button
voltage is programmed wrong and button presses on a headset are either
missed or reported as the wrong button.

Pass the unshifted value and let the helper place it in the field.

Link: https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-2-8bc1212db6f7@oss.qualcomm.com/
Fixes: 8ad5294 ("ASoC: codecs: add new pm4125 audio codec driver")
Assisted-by: Claude Opus 5
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
…nced

The analog master bias is shared between the microphone bias supplies
and the playback and capture paths, so pm4125_global_mbias_enable() and
pm4125_global_mbias_disable() reference count it and only touch
PM4125_ANA_MBIAS_EN for the first user and the last one.

MICB_DISABLE clamps the per-supply reference count at zero but then
evaluates the enable and pull-up counts regardless, so a release that
has no matching request still reaches pm4125_global_mbias_disable() and
drops a reference it never took. The MBHC framework issues exactly such
a release: it takes MIC_BIAS_2 once when it starts detecting a plug
type and releases it both at the end of the correction work and again
from wcd_micbias_disable(). Inserting a jack while a stream is running
therefore switches the analog master bias off underneath it, leaving
the path up but silent, and it stays silent until another stream takes
the first reference again.

Return early when there is nothing to release, so the hardware is only
touched for a request that was actually made.

While at it, use atomic_dec_if_positive() for the global count.
atomic_dec_and_test() lets it go negative, and once it is negative the
next enable increments it to zero instead of one and never re-arms the
bias at all.

Link: https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-3-8bc1212db6f7@oss.qualcomm.com/
Assisted-by: Claude Opus 5
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
…k detection

The codec only hands the MBHC framework the electrical bias and button
threshold callbacks, and leaves the rest of struct wcd_mbhc_cb empty.
The framework falls back to driving the shared register fields itself
for some of them, but it has no fallback at all for the ones that
control hardware it cannot describe generically, so plug type detection
runs without the RCO clock, without a micbias ramp and without the
headset ground detection comparator, and never gets a usable ADC
reading.

Add the callbacks the ADC based detection logic needs:

 - clk_setup() enables the MBHC RCO, which clocks the detection FSM.
 - micbias_enable_status() lets the framework tell whether MIC_BIAS_2
   is already up for recording, so it does not switch the button
   current source on underneath a capture stream.
 - hph_pull_up_control() selects the HPHL pull up current used while
   sensing an insertion, defaulting to 3uA as the hardware expects.
 - mbhc_micbias_control() routes the framework's MIC_BIAS_2 requests
   through pm4125_micbias_control() so they share the reference count
   with the DAPM micbias widgets and with the analog master bias.
 - mbhc_micb_ramp_control() ramps MIC_BIAS_2 instead of stepping it,
   which is required before the cross connection check reads the
   Schmitt trigger outputs.
 - mbhc_micb_ctrl_thr_mic() raises MIC_BIAS_2 to the threshold needed
   to tell a special headset from an extension cable, and puts it back
   afterwards.
 - get_micbias_val() reports the programmed MIC_BIAS_2 voltage. The
   generic path assumes a 1V base, while this codec starts at 1.6V in
   50mV steps, so the framework would scale every threshold wrongly.
 - mbhc_gnd_det_ctrl() enables the headset ground pull up comparator
   together with ground detection, in that order on the way up and the
   reverse on the way down.
 - hph_pull_down_ctrl() parks the headphone outputs in a pull down
   while no jack is being driven.

pm4125_mbhc_micb_adjust_voltage() changes MIC_BIAS_2 while it is
enabled, which has to be done with the output briefly pulled up, so
serialise it against concurrent requests with a mutex.

Link: https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-4-8bc1212db6f7@oss.qualcomm.com/
Assisted-by: Claude Opus 5
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
@qlijarvis

Copy link
Copy Markdown

PR #1323 — validate-patch

PR: #1323

Verdict Issues Detailed Report
❌ 2 Full report

Final Summary

  1. Lore link present: Yes — all 4 commits have valid lore.kernel.org links
  2. Lore link matches PR commits: No — commit 3/4 adds 4 lines of code (jack switch type override) not present in the lore patch; commits 1/4, 2/4, and 4/4 match exactly
  3. Upstream patch status: ⏳ Decision Pending — series posted 6 days ago (Oct 15, 2026); no maintainer review, acceptance, or rejection signals found in lore threads
  4. PR present in qcom-next/topics: Fail - 1/4 commit(s) are missing from both qcom-next and topics
Verdict: ❌ — click to expand

🔍 Patch Validation

PR: #1323 - ASoC: codecs: pm4125: Enable MBHC jack detection
Upstream commits: https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-0-8bc1212db6f7@oss.qualcomm.com/
Verdict: ❌ FAIL

Commit Message

Commit Check Status Note
1/4 Subject matches upstream ✅ Identical with FROMLIST: prefix
1/4 Body preserves rationale ✅ Complete match
1/4 Fixes tag present/correct N/A No Fixes tag (new feature)
1/4 Authorship preserved ✅ From: matches lore author
1/4 Backport note N/A FROMLIST: prefix correct
2/4 Subject matches upstream ✅ Identical with FROMLIST: prefix
2/4 Body preserves rationale ✅ Complete match
2/4 Fixes tag present/correct ✅ Fixes: 8ad5294 present
2/4 Authorship preserved ✅ From: matches lore author
2/4 Backport note N/A FROMLIST: prefix correct
3/4 Subject matches upstream ✅ Identical with FROMLIST: prefix
3/4 Body preserves rationale ✅ Complete match
3/4 Fixes tag present/correct N/A No Fixes tag (new feature)
3/4 Authorship preserved ✅ From: matches lore author
3/4 Backport note N/A FROMLIST: prefix correct
4/4 Subject matches upstream ✅ Identical with FROMLIST: prefix
4/4 Body preserves rationale ✅ Complete match
4/4 Fixes tag present/correct N/A No Fixes tag (new feature)
4/4 Authorship preserved ✅ From: matches lore author
4/4 Backport note N/A FROMLIST: prefix correct

Diff

Commit File Status Notes
1/4 Documentation/devicetree/bindings/sound/qcom,pm4125-codec.yaml ✅ Identical to lore patch
2/4 sound/soc/codecs/pm4125.c ✅ Identical to lore patch
3/4 sound/soc/codecs/pm4125.c ❌ Extra hunks not in lore patch — PR adds 4 lines at pm4125_probe() to hardcode jack switch types (cfg->hphl_swh = false; cfg->gnd_swh = false;)
4/4 sound/soc/codecs/pm4125.c ✅ Identical to lore patch
4/4 sound/soc/codecs/pm4125.h ✅ Identical to lore patch

Upstream Patch Status

Commit Community Verdict
1/4 ⏳ Decision Pending — posted Oct 15, 2026 (6 days ago); no maintainer reply, review, or merge signal found
2/4 ⏳ Decision Pending — posted Oct 15, 2026 (6 days ago); no maintainer reply, review, or merge signal found
3/4 ⏳ Decision Pending — posted Oct 15, 2026 (6 days ago); no maintainer reply, review, or merge signal found
4/4 ⏳ Decision Pending — posted Oct 15, 2026 (6 days ago); no maintainer reply, review, or merge signal found

qcom-next/topics Presence

Per integration_presence_report.md:

Commit Status
1/4 ⚠️ partial — subject or partial tree evidence found in qcom-next, but full change not verified
2/4 ❌ missing — not found in qcom-next or topics
3/4 ⚠️ partial — subject or partial tree evidence found in qcom-next, but full change not verified
4/4 ⚠️ partial — subject or partial tree evidence found in qcom-next, but full change not verified

Overall: FAIL — 1/4 commits missing from both qcom-next and topics; 3/4 only partially matched

Issues

Commit 3/4 — Undocumented divergence from lore patch:

The PR adds extra code not present in the upstream lore patch:

+	/* PM4125 jack is wired normally-closed, ignore the DT switch type */
+	cfg->hphl_swh = false;
+	cfg->gnd_swh = false;

These 4 lines appear at the end of pm4125_probe() in the PR but are completely absent from the lore patch at https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-3-8bc1212db6f7@oss.qualcomm.com/.

Why this is a problem:

  1. Semantic change — The lore patch only fixes the micbias reference counting bug. The PR adds hardware-specific jack switch configuration that overrides device tree properties.

  2. No upstream attribution — This extra code has no lore link, no separate commit, and no explanation of why it's needed or where it came from.

  3. Violates FROMLIST: semantics — A FROMLIST: commit should faithfully represent what was posted to the mailing list. Additions belong in a separate QCLINUX: or PENDING: commit.

  4. Checkpatch would flag this — The comment style and placement suggest this was added locally without following the upstream review process.

Recommended fix:

Split commit 3/4 into two commits:

  • Commit 3a: FROMLIST: ASoC: codecs: pm4125: Keep the micbias reference count balanced — faithful copy of the lore patch, no extra lines
  • Commit 3b: QCLINUX: ASoC: codecs: pm4125: Override jack switch type for PM4125 hardware — the 4-line addition with a proper commit message explaining why PM4125 hardware requires normally-closed jack switches regardless of DT configuration

Verdict

Do not merge as-is. Commit 3/4 contains undocumented additions not present in the upstream lore patch. This violates the FROMLIST: prefix semantics and makes the PR non-reviewable against the upstream source.

Final Summary

  1. Lore link present: Yes — all 4 commits have valid lore.kernel.org links
  2. Lore link matches PR commits: No — commit 3/4 adds 4 lines of code (jack switch type override) not present in the lore patch; commits 1/4, 2/4, and 4/4 match exactly
  3. Upstream patch status: ⏳ Decision Pending — series posted 6 days ago (Oct 15, 2026); no maintainer review, acceptance, or rejection signals found in lore threads
  4. PR present in qcom-next/topics: Fail — 1/4 commits missing entirely; 3/4 only partially matched (subject found but full content not verified)

Deterministic Integration Presence

Integration Presence Report

This report is generated by Jarvis before validate-patch runs.
It is the authoritative source for whether PR changes are already present
in qcom-next or in the kernel topic branches.

Kernel repo: /local/mnt/workspace/sgaud/Qgenie/image_pipeline/kernel
qcom-next ref: 1a0586064ee1fbcefe49b6382ee17a236c590879
topics remote: topics -> https://github.com/qualcomm-linux/kernel-topics
topics fetch: fetched

Commit Subject qcom-next topics Final
1/4 [PATCH 1/4] FROMLIST: ASoC: dt-bindings: qcom,pm4125-codec: Add the partial - subject or partial tree evidence found, but full change was not verified missing - no subject, patch-id, or full tree-content match found partial
2/4 [PATCH 2/4] FROMLIST: ASoC: codecs: pm4125: Fix MBHC button threshold missing - no subject, patch-id, or full tree-content match found missing - no subject, patch-id, or full tree-content match found missing
3/4 [PATCH 3/4] FROMLIST: ASoC: codecs: pm4125: Keep the micbias partial - subject or partial tree evidence found, but full change was not verified missing - no subject, patch-id, or full tree-content match found partial
4/4 [PATCH 4/4] FROMLIST: ASoC: codecs: pm4125: Add the MBHC callbacks partial - subject or partial tree evidence found, but full change was not verified missing - no subject, patch-id, or full tree-content match found partial

Final Status

overall_status: FAIL
present_commits: 0/4
partial_commits: 3/4
missing_commits: 1/4
topics_checked_for_commits: 4/4
final_summary: PR present in qcom-next/topics: Fail - 1/4 commit(s) are missing from both qcom-next and topics

@qlijarvis

Copy link
Copy Markdown

PR #1323 — checker-log-analyzer

PR: #1323
Checker run: https://github.com/qualcomm-linux/kernel-config/actions/runs/39634648579

Checker Result Summary
Checker Result Summary
checkpatch ❌ 4 commits with Assisted-by: format warnings
dt-binding-check ✅ Passed
dtb-check ⏭️ Skipped (no DTS changes)
sparse-check ✅ Passed
check-uapi-headers ✅ Passed
check-patch-compliance ❌ 1 commit with content mismatch
tag-check ✅ All commits have FROMLIST: prefix

Detailed report: Full report

Checker analysis — click to expand

🤖 CI Checker Analysis (checker-log-analyzer)

PR: #1323 - ASoC: codecs: pm4125: Add MBHC jack detection support
Source: https://github.com/qualcomm-linux/kernel-config/actions/runs/39634648579

Checker Result Summary
checkpatch ❌ 4 commits with Assisted-by: format warnings
dt-binding-check ✅ Passed
dtb-check ⏭️ Skipped (no DTS changes)
sparse-check ✅ Passed
check-uapi-headers ✅ Passed
check-patch-compliance ❌ 1 commit with content mismatch
tag-check ✅ All commits have FROMLIST: prefix

❌ checkpatch

Root cause: All 4 commits use Assisted-by: Claude Opus 5 which doesn't match the expected format.

Failure details:

Commit 5219fcedb9ac ("FROMLIST: ASoC: dt-bindings: qcom,pm4125-codec: Add the MBHC jack properties")
WARNING: Assisted-by expects 'AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]' format
#31: 
Assisted-by: Claude Opus 5

Commit b616fb2c23fa ("FROMLIST: ASoC: codecs: pm4125: Fix MBHC button threshold programming")
WARNING: Assisted-by expects 'AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]' format
#22: 
Assisted-by: Claude Opus 5

Commit 94f47fd5fb67 ("FROMLIST: ASoC: codecs: pm4125: Keep the micbias reference count balanced")
WARNING: Assisted-by expects 'AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]' format
#32: 
Assisted-by: Claude Opus 5

Commit 53b86b165fa4 ("FROMLIST: ASoC: codecs: pm4125: Add the MBHC callbacks needed for jack detection")
WARNING: Assisted-by expects 'AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]' format
#47: 
Assisted-by: Claude Opus 5

Fix: Update the Assisted-by: tag format in all 4 commits to match the expected pattern. The correct format should be:

Assisted-by: Claude:Opus-5

Or with tools (if applicable):

Assisted-by: Claude:Opus-5 [checkpatch] [sparse]

Reproduce locally:

./scripts/checkpatch.pl --strict --ignore FILE_PATH_CHANGES --git b1c712400a3d970e06409c117c686b2451aaccb9..53b86b165fa4c4889ccd4ddad0df952a77417056

Fix command:

git rebase -i b1c712400a3d970e06409c117c686b2451aaccb9
# Mark all 4 commits as 'edit'
# For each commit:
git commit --amend  # Edit the commit message to fix Assisted-by: format
git rebase --continue

❌ check-patch-compliance

Root cause: Commit 94f47fd ("Keep the micbias reference count balanced") has content differences from the upstream lore patch.

Failure details:

Checking commit: FROMLIST: ASoC: codecs: pm4125: Keep the micbias reference count balanced
Change is different from the one mentioned in Link

The commit references:

Link: https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-3-8bc1212db6f7@oss.qualcomm.com/

Fix: Verify the content difference between the PR commit and the upstream patch:

# Fetch the upstream patch
b4 am --single-message -C -l -3 https://lore.kernel.org/all/20261015-pm4125_mbhc_support-v1-3-8bc1212db6f7@oss.qualcomm.com/ -o /tmp/upstream

# Compare the diff content
git format-patch -1 94f47fd5fb67 --stdout > /tmp/pr-patch.txt
diff <(awk '/^diff/,/^--$/' /tmp/pr-patch.txt | grep -E '^[+-][^+-]') \
     <(awk '/^diff/,/^--$/' /tmp/upstream/*.mbx | grep -E '^[+-][^+-]')

Possible scenarios:

  1. Context-only shift (false positive) — if only surrounding context lines differ, this is acceptable
  2. Legitimate adaptation — if changes were needed for the target tree, document them in the commit message
  3. Missing/extra hunks — ensure all upstream changes are included, or remove unrelated changes

If the difference is intentional (e.g., backport adaptation), consider using BACKPORT: prefix instead of FROMLIST: and document the changes in the commit message.

Reproduce locally:

cd /path/to/kernel
../kernel-checkers/check-patch-compliance.sh b1c712400a3d970e06409c117c686b2451aaccb9..53b86b165fa4c4889ccd4ddad0df952a77417056

Verdict

2 blockers to fix before merge:

  1. checkpatch (4 commits): Fix Assisted-by: format from Claude Opus 5 to Claude:Opus-5 in all 4 commits
  2. check-patch-compliance (1 commit): Investigate and resolve the content mismatch in commit 94f47fd — either align with upstream or document the intentional differences

Both issues require commit message amendments via git rebase -i. After fixing, force-push the updated branch to re-trigger CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants