Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ pkgbuilds/*/squashfs-root/
pkgbuilds/*/starter/
pkgbuilds/asdcontrol/asdcontrol/
pkgbuilds/dropbox-cli/dropbox-cli-*.py
pkgbuilds/hp-elitebook-x-g2i-camera/TESTPLAN-v2.md
pkgbuilds/hp-elitebook-x-g2i-camera/ipu6-drivers/
pkgbuilds/hp-elitebook-x-g2i-camhal-runtime/icamerasrc/
pkgbuilds/hp-elitebook-x-g2i-camhal-runtime/ipu7-camera-bins/
pkgbuilds/hp-elitebook-x-g2i-camhal-runtime/ipu7-camera-hal/
pkgbuilds/intel-ipu7-drivers/ipu7-drivers/
pkgbuilds/intel-ipu7-drivers/vision-drivers/
pkgbuilds/libcamera-ov05c10/libcamera/
pkgbuilds/macbook12-spi-driver-dkms/macbook12-spi-driver/
pkgbuilds/omazed/steps.txt
pkgbuilds/symfony-cli/symfony*
Expand Down
3 changes: 3 additions & 0 deletions pkgbuilds/hp-elitebook-x-g2i-audio/.omarchy/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"source": "local"
}
16 changes: 16 additions & 0 deletions pkgbuilds/hp-elitebook-x-g2i-audio/50-wait-tas2783.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Service]
# Wait for the TAS2783 amp controls to appear before WirePlumber enumerates the
# card, so it does not build a profile from a half-enumerated device.
#
# The leading "-" is deliberate and load-bearing. This guard is an optimisation:
# without it the amps sometimes enumerate late and the audio-recover user unit
# heals it a moment later. But WirePlumber treats a failed ExecStartPre as a
# failed start, and a failed WirePlumber is not "no speakers", it is no audio at
# all -- no card, no sinks, nothing. Trading a boot race for total silence is a
# bad trade, so a guard that cannot run must not be able to stop WirePlumber.
#
# Observed on the reference machine: a stale drop-in of this name left in
# /etc/systemd/user, which outranks this file, pointed ExecStartPre at a path
# that no longer existed. WirePlumber hit 203/EXEC, exhausted its restart limit
# and gave up. The kernel side was perfectly healthy the entire time.
ExecStartPre=-/usr/bin/wait-tas2783-controls
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Syntax 8

# HP EliteBook X G2i (board 8E86): four TAS2783A amps on SoundWire link 2.
#
# This path is probed before conf.d/sof-soundwire/sof-soundwire.conf, so it
# stands in for the card configuration on this model alone. It takes the stock
# configuration unchanged and only points the speaker file at our own, because
# alsa-ucm-conf ships its own sof-soundwire/tas2783.conf and two packages
# cannot own one path.
#
# Gated on an amp control so a machine whose amps did not enumerate falls back
# to the stock file instead of a speaker definition it cannot drive.

Include.base.File "/sof-soundwire/sof-soundwire.conf"

If.hp_elitebook_x_g2i_amps {
Condition {
Type ControlExists
Control "name='tas2783-1 Amp Volume'"
}
True.Define.SpeakerCodecFile "tas2783-hp-elitebook-x-g2i"
}
100 changes: 100 additions & 0 deletions pkgbuilds/hp-elitebook-x-g2i-audio/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Maintainer: Meir Dick <mdick85@gmail.com>
#
# Speakers and microphone for the HP EliteBook X G2i (Panther Lake).
#
# The board pairs an RT712 SDCA codec with four TAS2783 smart amps. The kernel
# changes needed to drive that combination ship in linux-omarchy and its
# -eevdf and -muqss siblings: a Panther Lake ACPI match-table entry, the
# patches that split the four-amp link across two PDIs so the speakers are
# stereo rather than four copies of the left channel, and the amplifier
# resume and calibration fixes. The TAS2783A component name the card needs
# for " spk:tas2783" is in 7.2.
#
# No kernel is listed in depends: the patches are in all three Omarchy
# kernels, and naming one of them would pull that kernel onto a machine
# running another.
#
# With those in place stock alsa-ucm-conf does the rest, and this package is
# only the userspace remainder:
#
# - the Speaker device definition, at the path HiFi.conf already looks for
# - firmware filename symlinks the tas2783 driver asks for
# - two layers of protection against the amp enumeration race at boot
#
# No DKMS. Nothing here overrides a file another package owns.
#
# It carries no vendor tuning data. The perceptual voicing ships separately as
# an Omarchy audio tuning.

pkgname=hp-elitebook-x-g2i-audio
pkgver=1.1.0
pkgrel=10
pkgdesc="Speaker and microphone support for HP EliteBook X G2i (TAS2783 + RT712)"
arch=('x86_64')
url="https://github.com/omacom-io/omarchy-pkgs"
license=('GPL-2.0-or-later')
# alsa-utils for amixer, which both the boot guard and the self-heal use.
#
# The dependency on linux-omarchy is deliberate and is the point of this shape:
# the match-table entry and the stereo series live there, and without them
# everything else in this package is inert. Omarchy installs linux-omarchy on
# every machine, so this only records the requirement.
depends=('alsa-ucm-conf' 'alsa-utils' 'sof-firmware')
install=hp-elitebook-x-g2i-audio.install
options=('!debug')

source=(
'50-wait-tas2783.conf'
'README.package.md'
'hp-elitebook-x-g2i-audio-recover'
'hp-elitebook-x-g2i-audio-recover.service'
'hp-elitebook-x-g2i-audio.install'
'tas2783-hp-elitebook-x-g2i.conf'
'HP-HPEliteBookXG2i14inchNotebookNextGenAIPC-SBKPFV3-8E86.conf'
'wait-tas2783-controls'
)
sha256sums=('da77438d271b1525de88323f834201b0410c9e096e1150d83dda6e63a24d6d71'
'abf09cc08c166e91e245c809e8db6690ea20c42f005e27539db012318436eb78'
'1a7dd01eb3e2ac348c60c0d817cc995f6a4266eecd547977f8909da0615d6590'
'fe3c2febeac04b485cb49f2bc9455f9e053c919c368bb759dcc3f56b9fab4692'
'38c220e00e8e84cc32319b191616403a48bbb0238357e6d7637247a528658914'
'23bf45d7ff90d91970c903dab72b583cd94848c69dcab3fc25b48a7dad1e64c2'
'e30dbb9ee2e4ecf343a92ff3faf196e6d2025451c391010201e1cba7eee202a3'
'8eeea8ee87e0fcfa7cb71add1e102fc95a95a62fdf1a2300a5327c2f2c3f9f47')

package() {
# The Speaker device, under a name of our own. The kernel reports
# " spk:tas2783", so sof-soundwire/HiFi.conf would include
# "/sof-soundwire/tas2783.conf" -- a path alsa-ucm-conf now ships itself, and
# two packages cannot own one file. The card override below redirects the
# include to this copy instead, which carries the per-amp volume caps and the
# analog gain the upstream file has no reason to know about.
install -Dm644 tas2783-hp-elitebook-x-g2i.conf \
"${pkgdir}/usr/share/alsa/ucm2/sof-soundwire/tas2783-hp-elitebook-x-g2i.conf"

# The card override. UCM probes conf.d/${CardDriver}/${CardLongName}.conf
# before the driver-wide file, so this applies to this model alone.
install -Dm644 "HP-HPEliteBookXG2i14inchNotebookNextGenAIPC-SBKPFV3-8E86.conf" \
"${pkgdir}/usr/share/alsa/ucm2/conf.d/sof-soundwire/HP-HPEliteBookXG2i14inchNotebookNextGenAIPC-SBKPFV3-8E86.conf"

# Boot race, layer one. WirePlumber can start before the amp kcontrols exist,
# which leaves the card on profile "off" with no sinks and no sources on a
# random subset of boots.
install -Dm755 wait-tas2783-controls "${pkgdir}/usr/bin/wait-tas2783-controls"
install -Dm644 50-wait-tas2783.conf \
"${pkgdir}/usr/lib/systemd/user/wireplumber.service.d/50-wait-tas2783.conf"

# Boot race, layer two. The wait narrows the window without closing it, and
# two of the three faults it misses look completely healthy from ALSA.
install -Dm755 hp-elitebook-x-g2i-audio-recover \
"${pkgdir}/usr/bin/hp-elitebook-x-g2i-audio-recover"
install -Dm644 hp-elitebook-x-g2i-audio-recover.service \
"${pkgdir}/usr/lib/systemd/user/hp-elitebook-x-g2i-audio-recover.service"
# Enabled by shipping the symlink: a user unit cannot be enabled from a
# package scriptlet, which runs as root with no user session in reach.
install -dm755 "${pkgdir}/usr/lib/systemd/user/default.target.wants"
ln -s ../hp-elitebook-x-g2i-audio-recover.service \
"${pkgdir}/usr/lib/systemd/user/default.target.wants/hp-elitebook-x-g2i-audio-recover.service"

install -Dm644 README.package.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
}
130 changes: 130 additions & 0 deletions pkgbuilds/hp-elitebook-x-g2i-audio/README.package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# HP EliteBook X G2i audio

Speakers and microphone for the HP EliteBook X G2i (Panther Lake): RT712 SDCA
codec plus four TAS2783 smart amps over SoundWire.

**Without this package and the kernel it depends on, the machine has no Speaker
device at all** — not quiet, absent. `pactl list cards` shows the card stuck on
profile `off` with no usable sink.

## Where the fix actually lives

Most of the fix is kernel-side, and every piece is an edit to a file that
already exists in the kernel. They ship as patches in `linux-omarchy`, the
Omarchy default kernel:

| Patch | What it does |
|---|---|
| `0520-asoc-ptl-match-hp-elitebook-x-g2i` | Adds the match-table entry for the board's RT712 (link 3) + quad TAS2783A (link 2). Without it SOF falls back to a barebones machine driver and never instantiates the amps. The array lists the amps L,R,L,R by physical side, which is load-bearing for stereo. |
| `0523-soundwire-stream-second-dai-ports` | Stops a second DAI joining a stream from overwriting the first DAI's port config. Not board-specific. |
| `0524-sof-sdw-four-amp-two-pdis` | Gives the amp dai_link two CPU pins, which selects the `sdca-2amp` topology. |
| `0525-tas2783-one-channel-per-amp` | `.set_tdm_slot` on tas2783, driven from the `tas2783-N` prefix by `asoc_sdw_ti_spk_rtd_init()`. |

The card reports `spk:tas2783` (the TAS2783A component name) from 7.2 on; no
patch is needed for that any more. The remaining tas2783 patches in
`linux-omarchy` (`0521`, `0522`, `0526`-`0528`) cover resume and the factory
calibration and are described in their own headers.

The last three are what make the machine stereo. Without them all four
amplifiers receive the same channel and the speakers play mono-left — a state
in which every check short of listening reports a healthy stereo card.

Neither belongs in DKMS. A DKMS module that rebuilds `snd-soc-acpi-intel-match`
has to carry a frozen copy of every Intel platform's match table, which silently
reverts upstream fixes for unrelated machines and stops compiling the first time
ASoC changes a struct — with no speakers and no warning as the failure mode.

## What this package installs

### 1. The Speaker device

`sof-soundwire/HiFi.conf` includes `/sof-soundwire/${SpeakerCodecFile}.conf`
with no whitelist. With the kernel reporting `spk:tas2783`, stock
`alsa-ucm-conf` resolves that to `tas2783` and picks up the file this package
ships. Nothing `alsa-ucm-conf` owns is modified or overwritten.

The device also pins the four per-amp digital trims to −12 dB. They default to
hardware maximum and are not reachable from PipeWire's volume control, which
sits on a separate downstream stage.

### 2. Firmware filename links

`tas2783-sdw.c` requests `8E86-2-{9,A,C,D}.bin`. `linux-firmware` ships the same
per-amp calibration blobs as `8E86-2-0x{9,A,C,D}.bin.zst`. A naming bug, not
missing firmware — so the package symlinks rather than copies, leaving
`linux-firmware` owning the real files. `post_remove` removes only symlinks it
created, never a real file.

### 3. Boot-race protection, two layers

The amps download firmware asynchronously at boot. If WirePlumber enumerates the
card first, the Speaker device is skipped and the whole HiFi profile comes up
unavailable — no sinks, no sources — on a random subset of boots.

`wait-tas2783-controls` runs as WirePlumber's `ExecStartPre` and waits, bounded
at 20 s, for every amp to settle. It does not wait on a kcontrol appearing and
a fixed sleep: all four controls are created when the components probe, but
each amp then applies its factory calibration in turn, about a second apart,
and an amp is not ready until its own pass is done. While one is still
initialising its register cache is synced over anything written, so the wait
writes the trim the UCM sequence will write anyway and requires all four amps
to hold it on two consecutive passes. It returns in about a second on a settled
card and never blocks login.

That narrows the window without closing it, so
`hp-elitebook-x-g2i-audio-recover.service` runs once per session afterwards and
checks three faults. The last two are the reason it exists, because both look
healthy from above:

- the card can sit on a perfectly healthy `HiFi` profile while the PipeWire
graph does not reach the speakers, so a profile-only check reports success on
a silent machine;
- the UCM Speaker sequence can be abandoned part-way, leaving the output
switches off and the per-amp trim at hardware maximum, while the profile is
`HiFi`, the graph is fully linked and every level reads plausible. Observed
on 7.2.8-11: kcontrols at 9.6 s, calibration finishing at 10.8, 11.9, 13.0
and 14.0 s, and WirePlumber enumerating at 13.6 s. The repair is gated on the
`Headphone Jack` kcontrol, because with headphones plugged in UCM switches
the Speaker device off on purpose and the controls read exactly the same.

It logs a graph snapshot on every run, healthy or not, and only restarts the
shell when it actually repaired something.

## Upstream status

The interim, in the same spirit as `dell-xps-touchpad-haptics`. Each of these
retires a layer when it lands:

| Piece | Real home | Status |
|---|---|---|
| Match-table entry | Linux, `soc-acpi-intel-ptl-match.c` | not submitted |
| TAS2783A component name | Linux, `sound/soc/sdw_utils/soc_sdw_utils.c` | merged, `79bec4638` |
| Second-DAI port overwrite | Linux, `drivers/soundwire/stream.c` | not submitted; a general bug |
| Two-PDI amp split | Linux, `sof_sdw.c` + `soc_sdw_ti_amp.c` | not submitted |
| Firmware naming | `linux-firmware` / `tas2783-sdw.c` | partly merged, `e26bb459d` |
| Speaker device definition | `alsa-ucm-conf` | not submitted |

## Scope

This package carries **enablement only** — it makes the hardware work, and
contains no vendor-derived tuning data. The perceptual voicing (HP's factory
DTS:X Ultra curve) ships separately as an Omarchy audio tuning, matched on the
DMI SKU, and is an independent decision.

## Verifying

```bash
amixer -c 0 info | grep Components # expect " spk:tas2783"
pactl list cards | grep 'Active Profile' # expect HiFi
journalctl -k -b | grep -o 'sof-sdca-.amp' # expect sdca-2amp, NOT sdca-1amp
speaker-test -c 2 -t pink # left must come from the left
wpctl status # expect a Speaker sink and a Mic source
journalctl --user -u hp-elitebook-x-g2i-audio-recover -b
```

`sdca-1amp` means the two-PDI split did not take effect and the machine is
playing mono out of all four speakers. That is a kernel-patch problem, not a
tuning problem — do not go looking at levels.

A reboot is required after install: the kernel side of the fix cannot apply to
the running kernel.
Loading
Loading