Repository navigation
Conversation
The card outputs run from MPLLs for one or both rate families, and the MPLLs run 19 to 23 ppm slow, so audio drifts against video. hifi_pll makes both families exactly, but one PLL serves every output, so two streams at different families cannot both run from it. The t7 hifi_pll took its rate from a one-entry 48k table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on no other PR.
Problem
On G12A, G12B, SM1, SC2, T7 and T7C audio outputs run from MPLL clocks for one or both rate families, and those run 19 to 23 ppm slow, so audio drifts 69 to 83 ms per hour behind the picture. On SC2 a 48 kHz PCM title after a 44.1 kHz passthrough title can also play 0.7% slow, because HDMI PCM and passthrough share one MPLL.
SamuriHL found that the G12B MPLL runs the 48 kHz audio clock about 20 ppm slow, in the real_player branch of his CoreELEC Kodi fork (https://github.com/SamuriHL/coreelec-xbmc).
Change
Every output (HDMI PCM, HDMI passthrough, optical and analog) now takes both rate families from hifi_pll, which makes 491.52 MHz and 451.584 MHz to within 0.1 ppm. An open stream holds hifi_pll at its rate with clk_set_rate_exclusive. A stream at the other family runs from the spare MPLL the device tree names as clk_src_mpll, and without a spare the drivers set the rate as before. T7's hifi_pll took its rate from a one-entry 48 kHz table, and on 64-bit it now takes T3's multiplier range.
Tested with
The output rate is the hardware playback position fitted against the box's raw monotonic clock over 150 s, in ppm, and each fit carries an error of 0.04 to 0.74 ppm. Without this PR is the PR base kernel, with neither this PR nor "audio: report the FRDDR FIFO fill as playback delay". Kodi plays the HDMI rows, and optical and analog play through aplay with Kodi idle. A cell gives the range over the four devices and names a device that stands apart. Every value of -19 to -23 ppm is an output on an MPLL. With this PR every output runs from hifi_pll, or from hifi1_pll at 44.1 kHz on the AM9 Pro as before. The R 4K Plus row for 48 kHz PCM on HDMI without this PR ran after a 44.1 kHz passthrough row and stayed at the 44.1 kHz rate, the case of the second table. A clean start there reads -19.7 to -20.0 ppm. Full data in the measurement data. Every sample ran on each device listed under Tested on.
The second table reads each stream's output clock in the clock tree while two streams play at once on different outputs (aplay), and while Kodi plays 44.1 kHz PCM, 44.1 kHz AC-3 passthrough and then 48 kHz PCM. Nominal is 12288000 or 11289600 Hz for PCM and 6144000 or 5644800 Hz for S/PDIF at 48 and 44.1 kHz, read to within 10 ppm. The first two rows are cases the base kernel already gets right.
Result
Audio keeps its rate through a whole film at both rate families, also after a passthrough title, and a second program on another output no longer changes the first stream's speed. G12A and SM1 share G12B's clock driver and T7C shares T7's, but we have no such box to run them.
Tested on
CoreELEC 22 nightly 20261124 with this PR's commit, "audio: report the FRDDR FIFO fill as playback delay" and an earlier build of the CoreELEC/xbmc A/V sync PRs, common_drivers on Linux 5.15.196, tested 2026-11-24. No library change and no CoreELEC patch needed. AM9 Pro (S905X5), AM6B+ (S922X), Dune/Homatics R 4K Plus (S905X4), Fire TV Cube 3rd gen (T7).