Skip to content

fix(audio): detect headphone jack on AYANEO Pocket S2 - #663

Merged
JPyke3 merged 1 commit into
armada-os:mainfrom
rafalrojek:fix-pocket-s2-headphone-jack
Nov 1, 2026
Merged

JPyke3 merged 1 commit into
armada-os:mainfrom
rafalrojek:fix-pocket-s2-headphone-jack

Conversation

@rafalrojek

Copy link
Copy Markdown

Problem

On the AYANEO Pocket S2, headphones plugged into the 3.5mm jack are never detected and audio keeps playing from the speakers.

Cause

Two independent issues:

  1. DTS: the WCD939x codec node had no qcom,hphl-jack-type-normally-closed / qcom,ground-jack-type-normally-closed. Without them wcd_dt_parse_mbhc_data() sets hphl_swh/gnd_swh to true, i.e. the opposite switch polarity, and MBHC plug detection loops forever (mbhc sw intr rises, Elect Insert stays 0, Headphone Jack stays off). The vendor Android DT has qcom,msm-mbhc-hphl-swh = <0> and qcom,msm-mbhc-gnd-swh = <0>, which map to normally-closed, as on Pocket Micro2 and FIT Elite.
  2. UCM: APS2/HiFi.conf used JackControl "Headset Jack", which is the input device name, not an ALSA control (the controls are Headphone Jack, Mic Jack, DP0 Jack). PipeWire reported the port as availability unknown and stayed on the speaker. All other devices use Headphone Jack.

Changes

  • packages/kernel/dts/sm8650-ayaneo-ps2.dts.patch: add both jack-type properties to &wcd939x.
  • system_files/usr/share/alsa/ucm2/Qualcomm/sm8650/APS2/HiFi.conf: JackControl "Headphone Jack".

Testing

Tested on a Pocket S2 running 20261007.816091e with a 4-pole headset, by swapping in a patched sm8650-ayaneo-ps2.dtb and a bind-mounted UCM file (not a full image build):

  • Headphone Jack / Mic Jack go to on, PipeWire marks the Headphones port available and the Speaker not available, default sink switches to Headphones, audio plays in the headphones.
  • With the old UCM and the new DTB, the kernel reports the jack but PipeWire keeps availability unknown and stays on the speaker, so the UCM change is required.

Not verified: the headset microphone (the sensed plug type was HPH Type = 2, and the Headset UCM device is still commented out), and a full image build with the patch applied (the DTS patch was only dry-run against the DTS with patch).

🤖 Generated with Claude Code

Headphones plugged into the 3.5mm jack were never detected and audio kept
playing from the speakers. Two independent causes:

- The Pocket S2 DTS lacked qcom,hphl-jack-type-normally-closed and
  qcom,ground-jack-type-normally-closed on the WCD939x codec. Without them
  the MBHC code assumes the opposite switch polarity and plug detection
  loops forever (Elect Insert never fires, Headphone Jack stays off).
  The vendor Android DT sets msm-mbhc-hphl-swh = msm-mbhc-gnd-swh = 0,
  which maps to normally-closed, like Pocket Micro2 and FIT Elite.
- The APS2 UCM profile used JackControl "Headset Jack", which is the input
  device name rather than an ALSA control. PipeWire therefore never learned
  the jack state and stayed on the speaker. Use "Headphone Jack" like all
  other devices.

Generated by: Claude | Model: Claude Sonnet 4.6 | Role: AI-Generated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mrdidit

mrdidit commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

@rafalrojek

Hey

Rebuilt against Armada preview 20261024.fea5c39. Headphone detection and output switching work, but playback becomes badly distorted above roughly 10% volume.

Have you ever experienced distortion?

@JPyke3 JPyke3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks all good. It seems like there is a distortion issue but that can be fixed outside the scope of this PR. This one just provides DTS definitions

@github-actions

Copy link
Copy Markdown

Disk image

armada-disk-pr663, built from f35fdb5

Downloads as a zip holding armada-*.img.gz and its .sha256.
GitHub requires you to be signed in to download run artifacts.

@rafalrojek

Copy link
Copy Markdown
Author

@JPyke3 Thanks for approving.

@mrdidit I will investigate this in next week. When I will have sometinh I will prepare next PR.

@JPyke3
JPyke3 merged commit 648e7ef into armada-os:main Nov 1, 2026
3 checks passed
@rafalrojek

Copy link
Copy Markdown
Author

@mrdidit if you want you can look at #834 where I tried to fix volume issue. I think that it should be done better but at this moment I don't know how. When I tryied copy solution form Androind I got only noises :/

@mrdidit

mrdidit commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

@rafalrojek

I do have a fix but kept as draft. Sleep breaks it and I had no time to deal with it yet.

#817

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.

4 participants