From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9849AC61DD3 for ; Tue, 1 Sep 2026 11:25:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=D6grRP323bF9q5yVdCk/oWIzc9V0hkmgoLhFUu4FvGw=; b=G7s4/9cSxRoMoS /qQkGzJvtLWIsHPylqS6paCbIxsL+hYI+ZoiMM0O2cu6LntwdgYnNzIQR1tpu9xlmEO9IP5+MCL+H vnSS2rPIm7t5Betx3OvJjrhRd9VUi3WRGeG9NnQaSM/bDwEdhDoLdckxnX73fguy9f1dPrpBwIYaN Lf+jsM3QOEFEE7zAcjDcPl950dPTuyIv8XC9vPeqhO70nVzg3zksUD7IQj3mT6Y5Zz1EvbWuzqT4K 6o4aSNHqFC5j8497mlsmoRpv6DYlThOq16h7CPvr1OF7AMkJLBnEXenozRrl9YoGfLyWjsHiNRF8K n27XJDeJs267NPSeGK8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1Mci-0000000Bgrv-1Eff; Tue, 01 Sep 2026 11:25:52 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1Mcf-0000000Bgr2-3EBt for linux-rockchip@lists.infradead.org; Tue, 01 Sep 2026 11:25:50 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-499b2981a7bso53330975e9.3 for ; Tue, 01 Sep 2026 04:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788261947; x=1788866747; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=O15Reb8K9UpgINjG0MBTMyi3oJTA2sKCTZI1fZ2J21s=; b=eKJJB21+RHfhbjLymbqldp7u0rzPTKX7HkuoOn+sbYMNMv9zVf5eHAd1QEbQCYuluM pY32ZitC+MOU4dCvBN5soMty1sAuGd9DD/GGq+bJZjtHzdccM/bf5sfxhHVstZZLyLoD I8wKkINgxXvK27QAMQvhYknwAnodjdVKxbtpbPwozfE73LWcX4lgn1PMGJSJBb0xHdXf VqN+GQxahu/9OZQnp+nbcNdSWqHonrHM2qZx8QtdB2zfmaN7A6JTku03t5LFiRpdbSE0 ZJKrt4bfPBqtsIpwqHKs6JOz9qK+nOQ57rPHYxX40QvmMV0PIaF59CSsZnqtYEg2erVh hSEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788261947; x=1788866747; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=O15Reb8K9UpgINjG0MBTMyi3oJTA2sKCTZI1fZ2J21s=; b=n+V6vFt47d+zl3aSUleXZLmvsAkyiaD6aopzO4FiZfD5OxQwxI7djg2Far7aYuzemz vfItEFbVmq/kLTqOEDy7dgb9aUJVgX4Vv5IYm7vIIJBTE6zSo/YxPTHa7eigZMokR6BI bCKM8symoJ49fKD1xo5S0LMffEoMqs9LOJXhmPKS8uAuWeuzzIZoU7BM86L70UfpeS0X hOpoeU+At83YruJF3YmQnxzsCehll9mkRWSkj+k+Os9drV4K7Md1tbyJz4ikp9yVIpFM xImwWIulMF/c70fLHmGPRJ4lDdjUnDhd/tHhOv0zcuFcpDjGA2FsqOAnQluxc1fPaUTH yQoA== X-Forwarded-Encrypted: i=1; AHgh+RoBtQLdP/pbarQnGAgObRQP9ggbm7lPQB9XxY9qZUr7GGhVmfDO1avwuRBMZNEq+djqvTYTT2iyatIrmRcSsw==@lists.infradead.org X-Gm-Message-State: AFuF++mXKJQ46UsSRyO3TWVp9EqpOJGY0ZwJxz7GMXQRas+FNB+LHBJ5 mKjTGv1Ugx6a9JM8KCjjxwmcY/iNGd3+ArHdCrCco71oSTunZm3xGF+T X-Gm-Gg: AR+sD13Z83yWzfzYVMDmeUAR/k5Ye8Aod7LrICQzWbCS6f/S5Bfzg76IQyK+ozv9sJq rf0YPsLaGlFBkDw53SrUDW1MfKH8YV/cApQkx2xIA+in3zcqiVvJZL4jvbMDoXocWlLJadvcoNk TAP+Kaz1GsaoczuQRUpwesmM225yYoORpt0JuwqTIEyjnIYzvYykcmuS8f8tGTXuyJ+Wy3bx4qk qBc1nQvVQz03kKJsnWJE74MTBo54atn1S20M5Qt4ZxGDwOPTuHwbVN3eUtI4noNW6578JPeajYd zuIIimFaxcKbI9eF5TjByX0Lq1jmALreFg+NAKRq4KWIhVFnFpJIkM+vqVUEXhcvTDNaVODgVYI GPVQV+wxYCM0zel98o/mGnBgrPO9uEA45mhxctQLKw1hIfTWbeHOhdzRIHzGir4r3D6y+yrECSq GfFCgIcNItpjqKn8l0bcWbRl7qQ7c/TXicLfqjk66mI5qQqE7CZyLMbB6y2NqsL8JO X-Received: by 2002:a05:600c:8011:b0:496:bbce:fc with SMTP id 5b1f17b1804b1-49cdc5660bamr148450025e9.12.1788261947024; Tue, 01 Sep 2026 04:25:47 -0700 (PDT) Received: from toolbox.. ([87.200.95.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49b91c510c9sm226325455e9.0.2026.09.01.04.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 04:25:46 -0700 (PDT) From: Christian Hewitt To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Cristian Ciocaltea , Daniel Stone , Detlev Casanova , Dmitry Baryshkov , Douglas Anderson , Andy Yan , Sugar Zhang , Heiko Stuebner , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/bridge: dw-hdmi-qp: Compute ACR CTS for unlisted TMDS rates Date: Tue, 1 Sep 2026 11:25:41 +0000 Message-ID: <20260901112541.84588-1-christianshewitt@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260901_042549_830282_A375531F X-CRM114-Status: GOOD ( 16.67 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org common_tmds_cts_table[] holds only six TMDS character rates (25.175, 25.2, 27, 54, 74.25 and 148.5 MHz), so dw_hdmi_qp_find_cts() returns 0 for everything else. dw_hdmi_qp_set_cts_n() then clears the CTS override enable and programs a value of 0, leaving the sink with no CTS to regenerate the audio clock from. Any deep colour link falls into this gap: a 10 bpc RK3576 HDMI output runs at 185625000 Hz (148.5 MHz * 1.25), which is absent from both tables. N is computed dynamically and comes out correct at 6144, but AUDPKT_ACR_CONTROL1 reads back as 0. Give CTS the same dynamic fallback that N already has, using the formula from the Audio chapter of the HDMI specification, and drop the -ENOENT returned into an unsigned int for the unlisted sample rates. Fixes: fd0141d1a8a2a ("drm/bridge: synopsys: Add audio support for dw-hdmi-qp") Assisted-by: Claude:claude-opus-5 Signed-off-by: Christian Hewitt --- This was found after testing unrelated patches from DetlevC that rename the RK audio cards to see the impact in Kodi. RK3588 had audio output, while RK3576 did not. I'd not used an RK3576 board for a while so tasked Claude to help triage the problem, and this was the finding. The problem appears to have been exposed since Kodi reworked plane selection logic and support for 10bpc planes; earlier Kodi/LibreELEC images were using 8bpc planes thus avoiding the problem. drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 45 ++++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c index 5f4718c3b9db..7cf327de0249 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -307,8 +308,15 @@ static unsigned int dw_hdmi_qp_find_n(struct dw_hdmi_qp *hdmi, unsigned long pix return dw_hdmi_qp_compute_n(hdmi, pixel_clk, sample_rate); } +static unsigned int dw_hdmi_qp_compute_cts(unsigned long pixel_clk, + unsigned long sample_rate, + unsigned int n) +{ + return div64_u64((u64)pixel_clk * n, 128ULL * sample_rate); +} + static unsigned int dw_hdmi_qp_find_cts(struct dw_hdmi_qp *hdmi, unsigned long pixel_clk, - unsigned long sample_rate) + unsigned long sample_rate, unsigned int n) { const struct dw_hdmi_audio_tmds_cts *tmds_cts = NULL; int i; @@ -320,23 +328,24 @@ static unsigned int dw_hdmi_qp_find_cts(struct dw_hdmi_qp *hdmi, unsigned long p } } - if (!tmds_cts) - return 0; - - switch (sample_rate) { - case 32000: - return tmds_cts->cts_32k; - case 44100: - case 88200: - case 176400: - return tmds_cts->cts_44k1; - case 48000: - case 96000: - case 192000: - return tmds_cts->cts_48k; - default: - return -ENOENT; + if (tmds_cts) { + switch (sample_rate) { + case 32000: + return tmds_cts->cts_32k; + case 44100: + case 88200: + case 176400: + return tmds_cts->cts_44k1; + case 48000: + case 96000: + case 192000: + return tmds_cts->cts_48k; + } } + + dev_dbg(hdmi->dev, "Rate %lu missing; compute CTS dynamically\n", pixel_clk); + + return dw_hdmi_qp_compute_cts(pixel_clk, sample_rate, n); } static void dw_hdmi_qp_set_audio_interface(struct dw_hdmi_qp *hdmi, @@ -471,7 +480,7 @@ static void dw_hdmi_qp_set_sample_rate(struct dw_hdmi_qp *hdmi, unsigned long lo unsigned int n, cts; n = dw_hdmi_qp_find_n(hdmi, tmds_char_rate, sample_rate); - cts = dw_hdmi_qp_find_cts(hdmi, tmds_char_rate, sample_rate); + cts = dw_hdmi_qp_find_cts(hdmi, tmds_char_rate, sample_rate, n); dw_hdmi_qp_set_cts_n(hdmi, cts, n); } -- 2.43.0 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip