Skip to content

fix(audio): control AYANEO Pocket S2 headphone volume digitally - #834

Closed
rafalrojek wants to merge 3 commits into
armada-os:mainfrom
rafalrojek:fix-pocket-s2-headphone-volume
Closed

rafalrojek wants to merge 3 commits into
armada-os:mainfrom
rafalrojek:fix-pocket-s2-headphone-volume

Conversation

@rafalrojek

Copy link
Copy Markdown

Follow-up to #663: a commenter reported that headphone playback on the AYANEO Pocket S2 becomes badly distorted above roughly 10% volume.

Problem

PipeWire drove the headphone volume through the HP mixer element, i.e. the HPHL/HPHR PA gain. With the WCD939x compander on, that register has no effect on the output level, so the only real attenuation was PipeWire's software volume (-60 dB at 10%). That is audibly distorted at such low digital levels. Attenuating in the codec instead is clean.

Changes

  • UCM (APS2/HiFi.conf, SM8650-APS2.conf): map HP Digital Playback Volume onto RX_RX0/RX_RX1 Digital Volume through ctl.default.map, as already done for Speakers Digital, and use it as the headphone playback mixer element.
  • Kernel (0539): the RX digital volume reaches +40 dB, so on the Pocket S2 only it is capped at 59 (-25 dB). Otherwise 100% of the slider would be +40 dB. In listening tests the output was clean up to RX 59 and crackled above it, with the compander on or off.

Testing

Tested on a Pocket S2 with 4-pin headphones: a module built from this patch set (cap 59) and the UCM from this branch, loaded at runtime on the running image (no full image build). Verified: the control max is 59 for RX0 and RX1, the slider spans the whole range, and playback is clean at low and high levels.

Not verified

  • No full image build or boot of this exact commit; the kernel module and UCM files were swapped in at runtime.
  • The kernel cap was listening-tested by one person with their own headphones and hearing; other headphones may behave differently.

Notes

  • Restarting PipeWire or reconnecting librespot resets its stream volume to 150% (+10.6 dB), which on its own causes the same distortion. Keep the stream at 100%. This is outside this PR.
  • Headphone PCM mode (as on Android) was tried and only produced loud noise, so it is not used.
  • Audio after suspend with a stream still open is a separate issue and not addressed here.

🤖 Generated with Claude Code

rrojek-cp and others added 3 commits November 2, 2026 12:25
Headphones on the Pocket S2 distorted from about 10% system volume.
PipeWire drove the volume through the "HP" mixer element, i.e. the
HPHL/HPHR PA gain, but with the WCD939x compander on that register has no
effect on the output level. The only real attenuation was PipeWire's
software volume (-60 dB at 10%), which is audibly distorted at such low
digital levels. Attenuating in the codec instead was clean.

- UCM: map "HP Digital Playback Volume" onto RX_RX0/RX_RX1 Digital Volume,
  as is already done for "Speakers Digital", and use it as the headphone
  playback mixer element.
- Kernel: the RX digital volume reaches +40 dB, so cap it at 74 (-10 dB)
  on the Pocket S2 only; otherwise 100% of the slider would be +40 dB.

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Listening tests showed the headphone output crackles above RX digital
volume 59 (-25 dB), with the compander on or off. PCM HPH mode, as on
Android, only produced loud noise, so it is not used.

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolve conflicts in patches/series and PATCHES.md after main dropped
the Pocket DS speaker cap (0538, reverted in armada-os#830). Regenerate 0539
against the series without 0538.

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

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

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Disk image

armada-disk-pr834, built from 8998f6d

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

Closing in favour of #817. I tested its PCM/ULP headphone path on a Pocket S2 and it fixes the underlying problem (full-range slider, no crackle, no pop, suspend/resume works), which this PR only worked around with a volume cap. Details are in the comment on #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.

2 participants