From patchwork Sun May 28 13:59:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Larumbe?= X-Patchwork-Id: 13257833 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 DE579C77B7E for ; Sun, 28 May 2023 14:00:39 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OdDsWHtSLAGnnpsma9oEt5E7eb6EzRIECGgS7FmjkPo=; b=g/dxVntv0foM3Y /lyX+EsHWUavhSmDR+DVW/o7bLbMveGCWis0GQ5+YANpIxJrosP4Kzu2KbnEizl9uSILM9a5Xs1GS oQay3SMU/hxAjW9al+pPDRVqcHrqNE3ua+mU5Z5xYnxnr8lebQL0mxaSJtGY/5fiq4WlSHf/TAHOj /7VHOhXtRCDwCXcDXtbFM3+bE8StIMEgUiQaxGusNeTHJfffCIk8TaObh5ccnSsLP82QK2C51cMt6 6hdCM9lA/Tq2snQE1DVpEjtdeyFSKWILnu+0AItnbH4Gez62SiKnciQimMjBwzMjENXOB8VTPtm9t t7+vstovaQG/fWNmETPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q3GwU-007ksT-1y; Sun, 28 May 2023 14:00:18 +0000 Received: from madras.collabora.co.uk ([46.235.227.172]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q3GwP-007kqJ-05 for linux-amlogic@lists.infradead.org; Sun, 28 May 2023 14:00:15 +0000 Received: from localhost.localdomain (unknown [IPv6:2a02:8010:65b5:0:1ac0:4dff:feee:236a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: alarumbe) by madras.collabora.co.uk (Postfix) with ESMTPSA id 6ECD86603050; Sun, 28 May 2023 15:00:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685282409; bh=4W6hrjY2g3aTsw7mbW+oQrTMViqXv01N11WY0VDxIqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hvRegcIRttaMWYQGRdgSniN+rPhaGk8idODuSC98GdNKRM1jPP7bDzykMIdWR+C68 J0HOXgeyVaYNmHoOL4VY+kV32LkYzfoCeK0/aNDAKYEYTdAD+L+l3xqGMPfFfQnHlY 17wNUuMCNL/k7EUygHPfM6llUACDEM7a+uokBcqLNSDcDh2+0fneIKuF1n+iITJfjM 14oh+ftNGgvH8LPlbVGik1iPK/UfmtiZHWn31pR36hDckWutnC0+9SDK8/SuM+LjhT 0Sqv4QWHiRpKyz9sPlLP3ZbLvl6VypO2HcDNd6l9f1tN/wAP1VXaNR0tsbpt5WdVVs fDtqTbCfN01jQ== From: =?utf-8?q?Adri=C3=A1n_Larumbe?= To: narmstrong@baylibre.com, khilman@baylibre.com, linux-amlogic@lists.infradead.org, dri-devel@lists.freedesktop.org, rfoss@kernel.org, andrzej.hajda@intel.com Cc: adrian.larumbe@collabora.com, kernel@collabora.com Subject: [PATCH 1/3] drm/meson: dw-hdmi: change YUV420 selection logic at clock setup Date: Sun, 28 May 2023 14:59:59 +0100 Message-Id: <20230528140001.1057084-2-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230528140001.1057084-1-adrian.larumbe@collabora.com> References: <20230528140001.1057084-1-adrian.larumbe@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230528_070013_203758_3BE20ED8 X-CRM114-Status: GOOD ( 11.26 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Right now clocking value selection code is prioritising RGB, YUV444 modes over YUV420 for HDMI2 sinks. However, because of the bus format selection procedure in dw-hdmi, for HDMI2 sinks YUV420 is the format that will always be picked during the drm bridge chain check stage. Later on dw_hdmi_setup will configure a colour space based on the bus format that doesn't match the pixel value we had calculated as described above. Fix it by bringing back dw-hdmi bus format check when picking the right pixel clock. Signed-off-by: Adrián Larumbe Acked-by: Neil Armstrong --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 ++++++ drivers/gpu/drm/meson/meson_dw_hdmi.c | 4 ++-- include/drm/bridge/dw_hdmi.h | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 603bb3c51027..d59a547f9cb2 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -3346,6 +3346,12 @@ static int dw_hdmi_parse_dt(struct dw_hdmi *hdmi) return 0; } +bool dw_hdmi_bus_fmt_is_420(struct dw_hdmi *hdmi) +{ + return hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format); +} +EXPORT_SYMBOL_GPL(dw_hdmi_bus_fmt_is_420); + struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, const struct dw_hdmi_plat_data *plat_data) { diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c index 3d046878ce6c..b49bb0d86efe 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -379,8 +379,8 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, mode->clock > 340000 ? 40 : 10); if (drm_mode_is_420_only(display, mode) || - (!is_hdmi2_sink && - drm_mode_is_420_also(display, mode))) + (!is_hdmi2_sink && drm_mode_is_420_also(display, mode)) || + dw_hdmi_bus_fmt_is_420(hdmi)) mode_is_420 = true; /* Enable clocks */ diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index f668e75fbabe..6a46baa0737c 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -206,4 +206,6 @@ void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data, bool force, bool disabled, bool rxsense); void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data); +bool dw_hdmi_bus_fmt_is_420(struct dw_hdmi *hdmi); + #endif /* __IMX_HDMI_H__ */ From patchwork Sun May 28 14:00:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Larumbe?= X-Patchwork-Id: 13257832 X-Patchwork-Delegate: neil.armstrong@linaro.org 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 44D32C7EE23 for ; Sun, 28 May 2023 14:00:40 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ot4Jd6XNAbhlVn2BYdYycNMvsitVT3iAhR/8FHJd8uQ=; b=A8lZYppWNmmtzg MSB0MJByrfDr+ujH1nh0Zfb/o/eto0VvolCEuxt4TmlXxjY22v3o47q6xQx/JXDjALjPHXGI1Z+mg Gca9428H7jprTdEvopjPh5nousi4skIbd83rdVKpN1l+5lLOiYViRWEUxW0kzaKBzvg5w3DjsnxS9 82FmjzylesFUxbDhy/6RUwqE4GCWxi3yfFKwvYfCtcOxmga0tZQi6rxw2jB+Z5B2nuD/yXdV8TT5Y PBphf6mmhNw/PMdqREU+l/zkCjxKyEqxCm6r/qvWG9Ys6eZeC7r1s3+K3iXT5G9RdtBwBMvw36pdh aSRI57DjuXCWyEJ6StCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q3GwU-007ksD-0n; Sun, 28 May 2023 14:00:18 +0000 Received: from madras.collabora.co.uk ([46.235.227.172]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q3GwO-007kqN-3C for linux-amlogic@lists.infradead.org; Sun, 28 May 2023 14:00:15 +0000 Received: from localhost.localdomain (unknown [IPv6:2a02:8010:65b5:0:1ac0:4dff:feee:236a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: alarumbe) by madras.collabora.co.uk (Postfix) with ESMTPSA id 9D44966031F4; Sun, 28 May 2023 15:00:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685282409; bh=AsSXYHUkFyBX1xgopDi8EBlEKBrTYKvlfNS5sqv9JVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kAhAaQYozMNIKdNTBTlcc6WGY8wUBBc4pzekU+PtDLhwE4CI9IsCDKkG/nfcTxIZW GfkjgIovEGLmpMTH8aEDspjs3aqOXDSyi30INr0hz6z10f8klkk2GS4mgL0Qhed9bD tggd6+JQyD6xUekLw/1xXD2OWgSCYtLi1JePs1+XM1ws4+jdcU747kvjy/RQl3aRR5 z2pkiM9FtmmpqhYm5Nz8e8MSFva+8N0WZWVEGcvriNjr+ffsxL5DUoFv58N3K90mgx Y0OmCDT3AD2dPQBMxkkGstsv5MBLvl8pfSH+R+34wb0QEuGce00yXqBkvNkatFGT5i YkCMK0mt7NThw== From: =?utf-8?q?Adri=C3=A1n_Larumbe?= To: narmstrong@baylibre.com, khilman@baylibre.com, linux-amlogic@lists.infradead.org, dri-devel@lists.freedesktop.org, rfoss@kernel.org, andrzej.hajda@intel.com Cc: adrian.larumbe@collabora.com, kernel@collabora.com Subject: [PATCH 2/3] dw-hdmi: truly enforce 420-only formats when drm mode demands it Date: Sun, 28 May 2023 15:00:00 +0100 Message-Id: <20230528140001.1057084-3-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230528140001.1057084-1-adrian.larumbe@collabora.com> References: <20230528140001.1057084-1-adrian.larumbe@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230528_070013_157547_3733EADD X-CRM114-Status: UNSURE ( 9.18 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The current output bus format selection logic is enforcing YUV420 even when the drm mode allows for other bus formats as well. Fix it by adding check for 420-only drm modes. Signed-off-by: Adrián Larumbe Acked-by: Neil Armstrong --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index d59a547f9cb2..1afb8f2603a0 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2710,9 +2710,10 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, /* Default 8bit fallback */ output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY8_0_5X24; - *num_output_fmts = i; - - return output_fmts; + if (drm_mode_is_420_only(info, mode)) { + *num_output_fmts = i; + return output_fmts; + } } /* From patchwork Sun May 28 14:00:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Larumbe?= X-Patchwork-Id: 13257835 X-Patchwork-Delegate: neil.armstrong@linaro.org 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 C7B4DC77B7E for ; Sun, 28 May 2023 14:00:46 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cmywRo/1AXVwIQ5TmZjeiBzuYx3ffVXSvdgHsDo7MNA=; b=mg896PJTUU2qHH BEqcjXVqmQG9erSejPfo2ar8cCwYo3RKo+/etOXIqJb9Q0fQ/HuDaOUmCNOC+NXxuz190DtY/cyd2 3g7whB/yTfiAqAYnm01EKoSoJdZRsViOxKUQCw5hzUtdDKeNUESN142B4zTaBi5eFuXYBlRAuNRji Zu34n7247zti2iURpvfcYbalnkZVeTXJNxDBzXPZrhWZ/Ftl9CgYw0UWW62w4T2PGzsczMBw54KgV Hw0f1E8q9Jp4AaildF3IAfP2JMLoQUosw9uu6EwGeZzv0lDUP52d4WFDtasXq6cFtVq4Br9Gi6stI X2u6h10O53Wy/z+Xjuwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q3GwR-007krg-13; Sun, 28 May 2023 14:00:15 +0000 Received: from madras.collabora.co.uk ([46.235.227.172]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q3GwO-007kqO-32 for linux-amlogic@lists.infradead.org; Sun, 28 May 2023 14:00:14 +0000 Received: from localhost.localdomain (unknown [IPv6:2a02:8010:65b5:0:1ac0:4dff:feee:236a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: alarumbe) by madras.collabora.co.uk (Postfix) with ESMTPSA id CB0DE6605703; Sun, 28 May 2023 15:00:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685282409; bh=WAUfQLx2Jieo3ZVT9QyOs1XdimqsQfzrhTGzzHuNnqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UsaflhS5AUD3IUDGG6mJOWvSWM0RdyCm9XK+eqwZkw9l/nH4lpxycPGbEg9/MeXXG ZhGm1aTOxrXsJmtyOqzR8ryyu9rm7Ffyg2ojaXsWTmW3S7+GIQhZd5aLZhhrYeSyup QbrL9PRvSt9mTXrPanRbAoMa/5mEpFqdZA7Rcz+iCu1RYZpMc4nkb4ye9olrJO9HQI TOWDh7RVXQCzrGf6+wGRfc2CNJQ69oSjCh4NLhTnHOocDLc1Wrtcd6Xn94AI4WZuQt vNdeTydpq+nBvYtasHTIYBf11AxAFFh3D9g2OMPjhTShg570rvsAKLDBsOvBPh+isy MiQWbMOR/KVow== From: =?utf-8?q?Adri=C3=A1n_Larumbe?= To: narmstrong@baylibre.com, khilman@baylibre.com, linux-amlogic@lists.infradead.org, dri-devel@lists.freedesktop.org, rfoss@kernel.org, andrzej.hajda@intel.com Cc: adrian.larumbe@collabora.com, kernel@collabora.com Subject: [PATCH 3/3] dw-hdmi: remove dead code and fix indentation Date: Sun, 28 May 2023 15:00:01 +0100 Message-Id: <20230528140001.1057084-4-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230528140001.1057084-1-adrian.larumbe@collabora.com> References: <20230528140001.1057084-1-adrian.larumbe@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230528_070013_123187_AE3AFAB5 X-CRM114-Status: UNSURE ( 8.41 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Signed-off-by: Adrián Larumbe Acked-by: Neil Armstrong --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 1afb8f2603a0..0accfb51509c 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -49,20 +49,6 @@ #define HDMI14_MAX_TMDSCLK 340000000 -enum hdmi_datamap { - RGB444_8B = 0x01, - RGB444_10B = 0x03, - RGB444_12B = 0x05, - RGB444_16B = 0x07, - YCbCr444_8B = 0x09, - YCbCr444_10B = 0x0B, - YCbCr444_12B = 0x0D, - YCbCr444_16B = 0x0F, - YCbCr422_8B = 0x16, - YCbCr422_10B = 0x14, - YCbCr422_12B = 0x12, -}; - static const u16 csc_coeff_default[3][4] = { { 0x2000, 0x0000, 0x0000, 0x0000 }, { 0x0000, 0x2000, 0x0000, 0x0000 }, @@ -856,10 +842,10 @@ static void dw_hdmi_gp_audio_enable(struct dw_hdmi *hdmi) if (pdata->enable_audio) pdata->enable_audio(hdmi, - hdmi->channels, - hdmi->sample_width, - hdmi->sample_rate, - hdmi->sample_non_pcm); + hdmi->channels, + hdmi->sample_width, + hdmi->sample_rate, + hdmi->sample_non_pcm); } static void dw_hdmi_gp_audio_disable(struct dw_hdmi *hdmi)