Repository navigation
Conversation
The Pocket FIT shares sm8650-ayaneo-common.dtsi with the Pocket S2, whose WCD939x node lacks qcom,hphl-jack-type-normally-closed and qcom,ground-jack-type-normally-closed, so MBHC never reports a plug. Set both in the Pocket FIT's own board file, as the FIT Elite's and the stock Android tree do. Fixes armada-os#426
The PDM receive path hisses on this jack. Like stock Android, play it in HPH PCM mode with CLS_H_ULP: give RX SoundWire port 9 the PCM timing and format enable in the board DT, and switch the Pocket FIT's headphone sequence in the APS2 profile to PCM, clearing both HPH port sets first so they don't collide.
|
@mrdidit any thoughts on this one? One day I will crack and buy this device 🤣 |
I don’t own the regular KPF, but I’ve been investigating similar headphone issues on the Pocket S2 😅 After fixing jack detection, audio was badly distorted above roughly 10%, and volume control wasn’t behaving properly. The first improvement kept PDM and disabled the codec companders, which made playback sound much better. I went through this PR, then checked stock Android’s actual mixer and register settings. Android uses PCM/ULP with codec companders enabled, and sounded clean right up to maximum volume. One difference worth comparing: the S2’s active Android transport uses packing mode 0, while this PR sets 1. There’s now an S2-specific PCM build based on the latest preview, using those captured Android settings without the −8 dB attenuation. It plays cleanly up to 32%, which sounds close to Android’s maximum loudness to my ears, but higher settings pop and distort. So the PCM approach makes sense, but the remaining clipping still needs investigating. Packing is a difference, can't confirm if it's the cause. |
|
@mrdidit my port 9 values (sinterval 0x31, offsets 0, hstart 0, hstop 0xf, 24-bit, block packing 1, lane 1) are copied from the tree's port 8, which match what the FIT Elite uses at port 9. My Android dump on the G3 Pocket FIT only captured the codec (0x3000+), LPASS and tinymix, not the SoundWire port registers, so I can't yet say what Android uses on this device. How did you capture the S2's transport? I'll grab the same on the G3 Pocket FIT Also does anyone know when the next beta release is gonna be out? |
|
Rooted Android over ADB, with headphones connected and audio actively playing. I mounted debugfs read-only and captured rx_swr_ctrl/swrm_reg_dump, alongside tinymix and the codec registers. Two consecutive captures showed port 9 active, with bank 1 selected and identical settings in both banks. Packing mode was 0; the other port 9 timing values matched yours. The important part is capturing during playback, since the port shuts down afterward. |
|
@mrdidit thanks for that! I ran the checks now and packing is actually 1, but the capture turned up something else on the class-H port, that I now confirmed on Armada. The master's BLOCK_CTRL3 reads back 0 whatever is written. Qualcomm's own SM8650 driver programs the HIFI row of Class-H (DP2) on Linux two thighs disagree
So on Linux the master sends class-H in columns 3-6 while the codec reads 0-15. Cause: If the codec misreads the class-H control, the HPH supply won't track the signal, which would fit clipping and pops only at high levels, on both the S2 and the Pocket FIT. Android also uses si 63 for class-H ( Moving the master's port 2 window to 0/15 in the DT would land on the HIFI port's columns, so I think the fix belongs in the codec driver: program DP2's HCtrl (or declare it FULL) and use si 0x3f. Since you build S2 kernels, would you be up for trying that? I can't build a kernel for the Pocket FIT on Beta right now. |
|
@ovid-io You were right about packing. The earlier claim of 0 came from the master dump without checking codec DP6 That was a gap in my investigation. Direct codec reads on the S2 now show packing 1, matching your findings. The Class-H DP2 timing and packing differences you described are present too. The follow-up also found another lead in Class-H startup. Android briefly applies startup settings, then restores the normal playback values. On Linux, enabling the second headphone channel can reapply those startup settings without repeating the restoration. That matches the values captured on the S2. A new S2 test build is running with a small WCD939x ULP sequencing change to prevent that repeated setup. This build tests the startup-sequencing issue first. The DP2 transport changes you suggested remain under consideration, depending on the results. |
|
@mrdidit an update, and a correction to my earlier comment. Correction: I wrote that stream.c writes BlockCtrl3 for every port. It doesn't. In Good news: with two kernel fixes the Pocket FIT's headphones are clean and loud at full volume at 0 dB digital, compander on, ULP, the same as stock Android. Your start-up lead was exactly it. The fixes are in #876 (commit):
I tested both as rebuilt modules on 20261109: the registers read back as Android's, the dropouts at loud peaks are gone, and so is the little noise when the amplifier powers up. #876 credits you for the start-up. Once it's merged, this PR's 8 dB of headroom can drop to 0 dB, and I'll update it then. If you can try 0083 on the S2 (#817), that would confirm it there too. |
With the WCD939x class-H fixes from armada-os#876 (patches 0082 and 0083) the Pocket FIT's headphones play clean at full volume at 0 dB digital, compander on, ULP, as stock Android. Drop the 8 dB of digital headroom PocketFitHeadphones.conf added as a workaround, and the matching restore on disable.
|
#876 is merged, so I've dropped the 8 dB of headroom: the Pocket FIT's headphones play clean at full volume at 0 dB, compander on, ULP, as stock Android. Ready for review. |
Disk image
Downloads as a zip holding |
Fixes #426.
Two problems with the 3.5mm jack on the KONKR Pocket FIT (SM8650, G3 Gen 3), one commit each.
1. The jack is never detected
Plugging headphones in does nothing:
mbhc sw intrcounts every plug and unplug, butElect Insertstays 0, theHeadphone Jackcontrol staysoff, and sound stays on the speakers.Cause. The Pocket FIT shares
sm8650-ayaneo-common.dtsiwith the Pocket S2, whosewcd939xnode has noqcom,hphl-jack-type-normally-closed/qcom,ground-jack-type-normally-closed. Without them MBHC assumes normally-open jack switches and reads every insertion as a removal. The Pocket FIT's own stock Android device tree (/sys/firmware/fdton its firmware) hasqcom,msm-mbhc-hphl-swh = <0>andqcom,msm-mbhc-gnd-swh = <0>, i.e. normally closed, withqcom,msm-mbhc-usbc-audio-supported = <0>(the jack doesn't go through the USB-C audio switch). The FIT Elite's board file already sets both; #663 found the same for the Pocket S2.Change. Both properties on
&wcd939xin the Pocket FIT's board patch (sm8650-konkr-pf.dts.patch), so the Pocket S2 is untouched.2. Constant hiss on the jack (none through a USB-C DAC)
The APS2 profile plays headphones on the WCD939x PDM receive path, which hisses here, as 0073's description says it does on the FIT Elite. Stock Android on this board plays the jack in HPH PCM mode (
HPH PCM Enable 1,RX_HPH PCM 1by default in every pineapplemixer_paths) withRX HPH Mode CLS_H_ULP, and is silent with the same headphones.What PCM mode needed on SM8650:
swr-port-mappingputs HIFI_PCM_L/R (0x3b/0x3c) on master port 9, asqcom,rx-port-mappingalready does, butsm8650.dtsileaves port 9's transport timing unset (0xff) and there is noqcom,pcm-ports-mask. The board patch gives port 9 the PCM timingsm8650.dtsialready has at port 8 (sinterval 0x31, offsets 0, hstart 0, hstop 0xf, 24-bit, block packing 1, lane 1: the values the FIT Elite uses at its port 9) andqcom,pcm-ports-mask = <0x200>. With HIFI_PCM mapped to port 8 instead, the stream ran (DMA advancing, ports enabled on both ends with matching timing) but the codec received silence: the RX macro's PCM tap feeds port 9.HPHL Switch/HPHR Switchenable whichever portHPH PCM Switchselects at that moment. A port left on from the other mode (alsa-state restore at boot) collides on the bus (qcom_swrm_irq_handler: SWR Port collision detected) and nothing plays. So the Pocket FIT's enable sequence first turns both off in both modes, then selects PCM.PocketFitHeadphones.conf, runs last. It sets Android's ULP mode and keeps the digital level at 0 dB, as stock Android (the class-H fixes are in fix(kernel): WCD939x class-H: program the class-H port window and run the start-up once #876). On disable it leaves PCM mode only after the shared disable sequence has turned the HIFI_PCM ports off.PlaybackMixerElem "HP Digital", as on the Elite and Odin 3), since in this mode the compander drives the PA.The profile change is limited to the Pocket FIT by the model condition the APS2 profile already uses; other APS2 devices keep their current sequence.
Testing
On a Pocket FIT running 20261010.c3d178c (kernel 7.2.6), with these device-tree changes made to the deployed
sm8650-konkr-pf.dtb(boot image rebuilt byarmada-bootimg-update) and the same profile in a user UCM copy, 27 Oct 2026:Headphone Jackgoesonwith headphones in and sound moves to them (Elect Insertstays 0; plug type and impedance are read:HPH Type 2, 21/22 ohm)BIAS_VBG_FINE_ADJ(a5 vs 55),CLASSH_MODE_2/3,FLYBACK_VNEGDAC_CTRL_2and the PA gain fieldSWR Port collisionwith the switch-clearing sequenceDevice tree: building
sm8650-konkr-pf.dtbfrom source the waybuild-kernel.shdoes reproduces the Beta image's tree byte for byte. On main (cb3a439) these patches change only the two jack properties,qcom,pcm-ports-maskand the port 9 entries of the nineqcom,ports-*tables, the same change tested on the device. Both profiles parse with alsa-lib's config parser.AI usage
The investigation (stock Android register and device-tree comparison, SoundWire register dumps), the patches and this text were drafted with Claude (Anthropic). The changes were applied to my own Pocket FIT and tested there as listed above.