From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: Simon Wright <simon@symple.nz>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Heiko Stuebner <heiko@sntech.de>,
Andy Yan <andy.yan@rock-chips.com>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Algea Cao <algea.cao@rock-chips.com>,
dri-devel@lists.freedesktop.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] drm/bridge: dw-hdmi-qp: use drm_hdmi_acr_get_n_cts() helper for audio N/CTS
Date: Wed, 3 Jun 2026 00:25:01 +0300 [thread overview]
Message-ID: <92ac1962-e43a-45a0-958e-e32385af098c@collabora.com> (raw)
In-Reply-To: <86fcf349-0a7a-4618-9001-612371b0f71b@symple.nz>
Hi Simon,
On 5/21/26 10:36 AM, Simon Wright wrote:
> dw_hdmi_qp_set_sample_rate() open-coded its own N and CTS lookup
> tables and search/compute helpers, but it lacked the out-of-table
> CTS fallback needed by strict HDMI sinks at TMDS rates not in the
> table. The original LG G3 OLED audio mute (linux-rockchip 070633)
> was caused by dw_hdmi_qp_find_cts() returning 0 at 185.625 MHz,
> leaving AUDPKT_ACR_CTS_OVR_EN clear and falling back to the
> controller's internal CTS auto-measurement, which produces incorrect
> timing on the wire at out-of-table rates.
>
> The shared drm_hdmi_acr_get_n_cts() helper in
> drivers/gpu/drm/display/drm_hdmi_helper.c already implements the
> correct behaviour: it has the HDMI 1.4b spec N/CTS tables, and for
> TMDS rates not in the table it computes CTS = (TMDS * N) / (128 * Fs)
> inline (the canonical HDMI spec formula). It is already used by
> drivers/gpu/drm/msm/hdmi/hdmi_audio.c.
>
> Convert dw_hdmi_qp_set_sample_rate() to call the helper. This
> removes ~200 lines of open-coded tables and search functions
> (dw_hdmi_qp_find_n, _compute_n, _find_cts, _audio_math_diff,
> _match_tmds_n_table, common_tmds_n_table[], common_tmds_cts_table[])
> and fixes the strict-sink audio mute as a side effect of using the
> helper's complete N+CTS path.
>
> Tested on R76S (RK3576) running Linux 7.0.1, against the LG G3 OLED
> (the sink that originally reported the mute in linux-rockchip
> 070633) at four TMDS rates spanning HDMI 1.4 and HDMI 2.0:
>
> TMDS Mode Audio with v3
> 148.5 MHz 1080p60 8-bit plays
> 185.625 MHz 1080p60 10-bit plays
> 297 MHz 1080p100 8-bit plays
> 594 MHz 3840p60 8-bit plays
>
> Without this change, the LG G3 mutes audio at 185.625, 297, and
> 594 MHz (every rate outside dw-hdmi-qp's open-coded CTS table,
> which contained only 148.5 MHz and below). With this change,
> drm_hdmi_acr_get_n_cts() supplies the correct CTS at every rate --
> table-canonical at 148.5 / 297 / 594 MHz, and computed via the
> HDMI 1.4b formula at 185.625 MHz. The 148.5 MHz row is a
> regression check confirming the in-table path is unchanged.
>
> The Kogan KALED43XU9210STA (a permissive HDMI 2.0 sink that plays
> audio at all rates with or without this change) was used as a
> no-regression control: audio plays at 594 MHz with v3 loaded.
>
> The open-coded N table in dw-hdmi-qp included optimised N values
> for some TMDS rates that are not in the helper's table (e.g.
> various non-CEA rates between 28-162 MHz). For those rates the
> helper's fallback returns N = 128 * Fs / 1000, which is the same
> value dw_hdmi_qp_compute_n() returned when no table optimisation
> was needed; no audio regression has been observed at the rates
> tested above.
>
> Reported-by: Simon Wright <simon@symple.nz>
> Closes: https://lore.kernel.org/linux-rockchip/ME3P282MB21960D9D68BFF520316BDFCEA83E2@ME3P282MB2196.AUSP282.PROD.OUTLOOK.COM/
> Suggested-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> Suggested-by: Jonas Karlman <jonas@kwiboo.se>
> Tested-by: Simon Wright <simon@symple.nz>
I think T-b can be dropped, as the commit description implies you've actually
tested this before submitting.
> Assisted-by: Claude:claude-opus-4-7
> Signed-off-by: Simon Wright <simon@symple.nz>
The patch looks good to me.
I'm unable to reproduce the reported issues, but I can confirm audio continues
to work as expected on my end.
Feel free to include:
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Tested-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Regards,
Cristian
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
prev parent reply other threads:[~2026-06-02 21:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 7:36 [PATCH v3] drm/bridge: dw-hdmi-qp: use drm_hdmi_acr_get_n_cts() helper for audio N/CTS Simon Wright
2026-06-02 21:25 ` Cristian Ciocaltea [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92ac1962-e43a-45a0-958e-e32385af098c@collabora.com \
--to=cristian.ciocaltea@collabora.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=algea.cao@rock-chips.com \
--cc=andrzej.hajda@intel.com \
--cc=andy.yan@rock-chips.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simon@symple.nz \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox