Skip to content

Nils's (dwaris) S9+ speaker fixes: the first sound, and the MAX98512's enable - #295

Merged
claudiusthebot merged 8 commits into
mainfrom
contrib/nils-dwaris
Nov 12, 2026
Merged

claudiusthebot merged 8 commits into
mainfrom
contrib/nils-dwaris

Conversation

@claudiusthebot

Copy link
Copy Markdown
Collaborator

@dwaris, thank you for this. You found these on your own S9+ at the same time as Anan Jaser was working through the same phone, and two of your four commits fix things his did not.

These are commits of dwaris/scion-kernel bringup-star2lte, cherry-picked onto main with their authorship kept (git cherry-pick -x).

Taken (2 of 4)

  • 761450a5 abox: await amp_hook registration in amps_start (here 06edb8d). The first sound is no longer lost when the stream starts before the amplifiers' driver has registered. One follow-up commit of ours (3041290): the wait of up to a second is taken once in a run, not at every sound. amps_start() is called again at each sound while no amplifier runs, so where no amplifiers' driver ever registers every one of those calls would have held the stream's thread for a second.
  • 6892d353 max98512: wake delay and retry backoff for GLOBAL_SHDN (here 798a759). Kept as it is. It sits well beside Anan Jaser's bac1971 (the enable read back for up to 50 ms, with a bus reset): the 2 ms before the first read makes that first read less likely to fail at all, and the 1 ms between a transfer's three tries only costs time when a transfer has already failed. Harmless on both phones by reading; whether Samsung's driver waits the same 2 ms I have not checked against its source.

Not taken (2 of 4), and why

  • 21f1cb07 ssp: shub_rot boot-arg. Superseded by bbbca06 (Anan Jaser), which is on main: the S9+ now sends Samsung's own mounting position (7; the S9 sends 4) to the sensor hub in its formation, and the hub turns the accelerometer's and the gyroscope's axes itself. shub_acc_pos=<0-7> is the manual override. A second rotation in the driver after the hub's would turn the S9+'s axes twice, and two switches for one thing would fight. What shub_rot did that the position does not: it also turned the magnetometer. The magnetometer's position is still the fixed 5 for both phones; if the S9+'s compass turns out wrong, that wants a shub_mag_pos= beside shub_acc_pos=, which is not in this pull request.
  • e7f0ab53 configs: document shub_rot (generated catalogue lines for the argument above).

Also here

  • devices/manifest.conf: the S9 and S9+ device repositories at their heads (Anan Jaser's device commits: the S9+'s device.conf as seen running, its firmware lists and fetch script), which build.sh DEVICE=star2lte looks for; the device pages made again.
  • README (Contributors) and NOTICE: Nils, with what was taken.

Checked (build machine, no phone)

  • The 16.5 gate: all six device configurations build (star2lte, crownlte, redwood, frankel, qemu, starlte) and the six catalogue checks pass.
  • ios-27: none of the files that kernel is built from is changed by this branch (the ios-27 tree does not build the audio drivers), so its kernel is main's.
  • The check workflow's steps locally: as on main (the three that fail on main are the ones pull request 294 fixes).
  • Not run on a phone. Both changes are in the speakers' start path of the S9 and S9+ on iOS 16.5; a boot with sound on each phone is the test that is owed.

npm run preflight does not apply (no Node project).

🤖 Generated with Claude Code

dwaris and others added 8 commits November 12, 2026 16:43
During early boot, ABOX's UAIF1 stream can start before the speaker amplifier
driver completes its identify/probe and registers via hakios_abox_set_amp().
Poll with a bounded retry (up to 1 s) in amps_start() before giving up on the
speaker amplifiers.

(cherry picked from commit 761450a)
… GLOBAL_SHDN

Waking the MAX98512 amplifiers out of global shutdown (GLOBAL_SHDN = 1)
powers up internal charge pumps and analog stages, during which immediate
I2C reads NACK (bus 0x400) and abort the driver.

Add a 2 ms wake delay after writing GLOBAL_SHDN = 1 (matching vendor driver
usleep_range), and add a 1 ms interval between raw_read and raw_write retries.

(cherry picked from commit 6892d35)
… at every sound

06edb8d (dwaris) lets amps_start() wait up to a second (100 x 10 ms) for the amplifiers' driver to register, which cures the
first sound being lost on the S9+ when the stream starts before the MAX98512 driver has registered. amps_start() is called
again at every sound while no amplifier runs, and neither amp_given_up nor amp_none_said stops that, so on a machine or a
configuration where no amplifiers' driver ever registers each of those calls held the stream's thread for the full second.
The wait is now taken once (amp_waited); after it a driver that registers later is still picked up at the next sound, as
before his change, without waiting.
…ads (Anan Jaser's device commits)

scion-starlte 87be95cc (pull request 60) and scion-star2lte ee5bfa36 (pull request 3): the S9+'s device.conf as seen running,
its own firmware lists and fetch script (no vendor file), which build.sh DEVICE=star2lte of this repository looks for, and
the S9's Bluetooth page. The pins were at the commits before those.
@claudiusthebot
claudiusthebot merged commit de6c6d9 into main Nov 12, 2026
3 checks passed
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