diff --git a/session-logs/2026-03-21-session.md b/session-logs/2026-03-21-session.md index c783d70..15dbba2 100644 --- a/session-logs/2026-03-21-session.md +++ b/session-logs/2026-03-21-session.md @@ -293,6 +293,143 @@ When CachyOS pushes a new kernel update, the AW88399 patch will be lost. Need to ### Key Technical Findings - `PreferredDevice::sink()` in plasma-pa's audioshortcutsservice skips virtual sinks — volume up/down shortcuts silently fail while mute works fine - SOF DSP `Post Mixer Analog Playback Volume` has coarse 2dB steps (0-45 range, -90dB to 0dB) — unsuitable as primary volume control -- HDA codec `Speaker Playback Volume` has fine 0.75dB steps (0-87 range, -65.25dB to 0dB) — proper volume control +- HDA codec `Speaker Playback Volume` has fine 0.75dB steps (0-87 range, -65.25dB to 0dB) — but only controls tweeter DAC - AW88399 amps go active/suspended via runtime PM — both show `stream=1, channel=0` during playback - Both DACs (0x02 and 0x06) receive audio simultaneously from the same PCM stream +- **ALSA hardware volume only affects tweeters** — Bass Speaker (pin 0x17/DAC 0x06/AW88399) has no volume control, only on/off switch. PipeWire software volume is required for balanced scaling. + +## Update: 07:15 — Volume Balance Fix, Forum Post Updates, Upstream Contributions + +### Session Summary +Discovered and fixed a critical volume balance issue (Issue 3): ALSA hardware volume only controls the tweeter DAC while woofers run at fixed amp gain. Also published and iteratively refined a comprehensive forum post, drafted comments for Kernel Bugzilla, CachyOS GitHub, and the community patch repo. + +### Issue 3: Tweeter/Woofer Volume Imbalance + +**Discovery:** At 100% volume the speaker mix sounded balanced, but at lower volumes (~60%) sound became muffled/bass-heavy. The tweeters got quieter but woofers stayed at full volume. + +**Root cause:** `Speaker Playback Volume` (the UCM2-mapped volume control) only controls DAC 0x02 (tweeters). DAC 0x06 (woofers via AW88399 amps) has NO ALSA volume control — only `Bass Speaker Playback Switch` (on/off). At 60% PipeWire volume, tweeters were at -12.75dB while woofers remained at 0dB. + +**Fix applied:** +1. Removed `PlaybackMixerElem`, `PlaybackMasterElem`, and `PlaybackVolume` from the UCM2 Speaker Value block in `/usr/share/alsa/ucm2/HDA/HiFi-analog.conf` +2. This forces PipeWire to use **software volume** — digital PCM attenuation before the codec, affecting both DACs equally +3. Locked ALSA Master and Speaker at 100% (0dB) permanently +4. Created WirePlumber rule for belt-and-suspenders: `~/.config/wireplumber/wireplumber.conf.d/51-legion-speaker-volume.conf` + +**Final UCM2 Speaker Value block:** +``` +Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" + PlaybackSwitch "Speaker Playback Switch" +} +``` + +### Configuration Changes This Update + +#### Files Modified +- `/usr/share/alsa/ucm2/HDA/HiFi-analog.conf` — Removed PlaybackMixerElem/PlaybackMasterElem/PlaybackVolume from Speaker section (in addition to the earlier Post Mixer override removal) + +#### Files Created +- `~/.config/wireplumber/wireplumber.conf.d/51-legion-speaker-volume.conf` — WirePlumber rule forcing `api.alsa.soft-mixer = true` on the speaker sink + +### Forum Post Publication & Updates + +**Published:** https://community.azcomputerguru.com/d/7-fix-lenovo-legion-pro-7-16iax10h-speaker-audio-on-linux-aw88399-smart-amps +- Discussion #7, Post #3 in Flarum database +- Tags: Gadgets & Hardware (6), How-Tos & Tips (7) + +**Issue encountered:** Initial post showed "error displaying content" because raw Markdown was inserted into the database. Flarum requires content parsed through its formatter (converts Markdown to XML). Fixed by bootstrapping Flarum's PHP app and using `Formatter::parse()`. + +**Flarum bootstrap pattern for future posts:** +```php +require '/home/azcomputerguru/public_html/community/vendor/autoload.php'; +$basePath = '/home/azcomputerguru/public_html/community'; +$paths = new \Flarum\Foundation\Paths(['base' => $basePath, 'public' => "$basePath/public", 'storage' => "$basePath/storage"]); +$configData = include "$basePath/config.php"; +$config = new \Flarum\Foundation\Config($configData); +$site = new \Flarum\Foundation\InstalledSite($paths, $config); +$app = $site->bootApp(); +$formatter = $app->getContainer()->make(\Flarum\Formatter\Formatter::class); +$actor = \Flarum\User\User::find(1); +$parsed = $formatter->parse($markdownContent, null, $actor); +``` + +**Iterative updates made to the post:** +1. Fixed rendering error (raw Markdown → Flarum XML) +2. Fixed bounty text from present tense ("There's a $2,000 bounty") to past tense ("was paid out") — bounty was claimed per Tom's Hardware article +3. Added Issue 3 (volume balance fix) +4. Added "Beyond the Community Patch" section explaining our unique findings +5. Linkified all Bugzilla, CachyOS, and KDE bug references +6. Updated heading to "Three Issues We Hit" +7. Updated Final Working Configuration to reflect software volume + +**Bounty background:** The $2,000 bounty was crowdfunded by 6 people (Alderon Games $1,000, Nadim Kobeissi $500, three others $200/$200/$70/$30). It was paid out. Covered by Tom's Hardware and Hacker News. + +### Upstream Contribution Drafts + +Three comment files drafted and opened in text editor for manual posting: + +1. **`/tmp/bugzilla-comment.txt`** → [Kernel Bugzilla #218329](https://bugzilla.kernel.org/show_bug.cgi?id=218329) + - Detailed technical report of both UCM2 issues + - Proposed solution with code snippets + - System details + +2. **`/tmp/cachyos-comment.txt`** → [CachyOS Issue #707](https://github.com/CachyOS/linux-cachyos/issues/707) + - Condensed version referencing Bugzilla comment + +3. **`/tmp/github-issue-nadim.txt`** → [nadimkobeissi/16iax10h-linux-sound-saga](https://github.com/nadimkobeissi/16iax10h-linux-sound-saga/issues/new) + - Full issue with title: "UCM2 volume routing issues — tweeter/woofer imbalance and Post Mixer clarity loss" + - Includes both issues, fix, and KDE hotkey bonus note + +**Status:** Files opened in text editor for user to copy/paste manually (no `gh` CLI available, Bugzilla requires browser auth) + +### Comparison: Our Fix vs Community Patch + +| Aspect | Community Repo | Our Fix | +|--------|---------------|---------| +| Kernel patch | Same | Same | +| Firmware | Same | Same | +| UCM2 | Their config as-is (Post Mixer override) | Remove Post Mixer override AND Speaker volume mapping | +| Volume control | Post Mixer Analog (2dB steps, -18dB at 50%) | PipeWire software volume (both DACs scale equally) | +| Volume balance | Not addressed (masked by Post Mixer) | Fixed via software volume | +| EasyEffects | Not mentioned | Warn against (breaks KDE hotkeys) | + +### Bluetooth Note +Bluetooth CAD-6005 audio adapter temporarily lost audio routing after PipeWire restarts. Not caused by our UCM2 changes — WirePlumber just reset the default sink. Fixed with `wpctl set-default 87`. Auto-switch policy is intact. + +### Final Working Audio Configuration (Updated) +``` +Kernel: 6.19.9-1-cachyos (patched with AW88399 HDA side-codec) +Default sink: alsa_output.pci-0000_80_1f.3-platform-skl_hda_dsp_generic.HiFi__Speaker__sink +Volume control: PipeWire SOFTWARE volume (no ALSA hardware volume mapping) +ALSA Master: Locked at 100% (0dB) +ALSA Speaker: Locked at 100% (0dB) +ALSA Bass Speaker: On (switch only, no volume) +SOF Pre Mixer: 45/45 (0dB) +SOF Post Mixer: 45/45 (0dB) +SOF Deepbuffer: 45/45 (0dB) +EasyEffects: Not running, autostart disabled +UCM2: Community config minus Post Mixer override AND minus Speaker volume mapping +WirePlumber: api.alsa.soft-mixer = true on speaker sink +Hotkeys: Working (increase/decrease/mute all functional) +Both speaker pairs: Active (tweeters + woofers scale together) +``` + +### All Files Created/Modified This Session (Complete List) +- `/usr/share/alsa/ucm2/HDA/HiFi-analog.conf` — Removed Legion Post Mixer block (lines 130-147) AND Speaker volume mapping (PlaybackMixerElem/MasterElem/Volume) +- `~/.config/autostart/com.github.wwmm.easyeffects.desktop` — Added `Hidden=true` +- `/etc/udev/hwdb.d/90-ite-keyboard-fix.hwdb` — ITE keyboard hwdb (harmless, from early debugging) +- `~/.config/wireplumber/wireplumber.conf.d/51-legion-speaker-volume.conf` — Soft mixer rule +- `~/.config/pipewire/pipewire.conf.d/` — Directory created (empty, filter-chain config was removed) +- `/tmp/bugzilla-comment.txt` — Kernel Bugzilla comment draft +- `/tmp/cachyos-comment.txt` — CachyOS GitHub comment draft +- `/tmp/github-issue-nadim.txt` — Community repo issue draft +- `/tmp/forum-post-legion-audio.json` — Forum post content (canonical source) +- `/tmp/post-to-forum.php` — Flarum database insertion script +- Various `/tmp/*.php` fix scripts for forum post updates + +### Pending/Incomplete Tasks +1. **Post upstream comments** — User needs to manually paste from the three `/tmp/*.txt` files into Bugzilla, CachyOS GitHub, and nadimkobeissi GitHub +2. **UCM2 package update risk** — Modified `/usr/share/alsa/ucm2/HDA/HiFi-analog.conf` will be overwritten by `alsa-ucm-conf` package updates +3. **Kernel update risk** — AW88399 patch lost on kernel updates, rebuild needed +4. **Cleanup** — `/home/guru/kernel-build/build/` still contains large build artifacts