From patchwork Mon Jun 12 11:23:52 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: 13276379 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 9622CC7EE23 for ; Mon, 12 Jun 2023 11:24:37 +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=9XmBZ+ObBgUItWOK+L4P2e2HY5hIOIrhkiJEYaxrTzs=; b=sALxYZL/hbOaar A4wkld+FuuCcUIibVVR3xhp9zzSR+2zTpEf9pvPUzzfOh+Ht3k82QSRLcDJ/+lttDXmVB5lUjiQ5O Iyn93w0w177dwDm3/SsRWomE/cLhSPiAJk4gf2DtIap4rdbvtyi+9hZLRlEXH2hVM/zWkRoEOWbaf 2auieIinK/DOfA1OTTlKUA3NiWzAmo8JgS5fQgjjUP7gaQDyqDkPtmoq5ZvSUV5L82oIPPg5E2dXz GoiVguWy+gHkXlXYV+zilMiWyRICtFHXFqt8KKnMw5wA2pe1km7lOeLEGhBhYVfBEQqkX5niqP4Ki Cgxh7sYq4kMlxVmWnutw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8fed-003kuD-0V; Mon, 12 Jun 2023 11:24:11 +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 1q8feX-003kpw-2h for linux-amlogic@lists.infradead.org; Mon, 12 Jun 2023 11:24:07 +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 C3CBE66003AF; Mon, 12 Jun 2023 12:24:00 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686569040; bh=1yMYjJpUmHOhxy9R4rRNyrik2fSSdpVqcKiFzvtx4yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZY+cawUmLKjtJrnrlP4lrAs0A9eXlotbQBkBnrc5TuTaNc9ywRIDI8ujyxjQZEBZj BEzJX+d/bFlExAP4lUAsP3XQ6sI88Y4FsatNgJbn5WOSO4QZnzKMSB9JR5jfOD9dFn 7oJxCGKrCYZ7RCuyIKbmEQn4fTiF+Eb5bnsnq5/lcZRszQZK9a0ci4D7qvbaP6EXHi /Xk4k3cuMdTIm3aDuem3bXbiq/JDDPZ7K155BKbwLFVylFWuCBM4N75UByyipJl6wK ZaiG3e1uLXY7c+sAGMraRFdnf1gl88aXSMNUI/jjwGQB4VZ7Mh0ElP/hAmoL2QZ6H0 7twRHJftb2W5w== 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 v2 1/3] drm/meson: dw-hdmi: change YUV420 selection logic at clock setup Date: Mon, 12 Jun 2023 12:23:52 +0100 Message-Id: <20230612112354.4034489-2-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230612112354.4034489-1-adrian.larumbe@collabora.com> References: <20230612112354.4034489-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-20230612_042406_070869_5A643DF5 X-CRM114-Status: GOOD ( 11.62 ) 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 --- 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 3b40e0fdca5c..e6a456b72610 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 Mon Jun 12 11:23:53 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: 13276376 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 998A8C7EE23 for ; Mon, 12 Jun 2023 11:24:32 +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=gxVECQUYe9q827SFWyeW4RX4+42Hj0BGZeFf3ypUAkc=; b=svSiuYQMMWKeco ei/U0UtbYlkgE8rotMGPlVkU2s8pXcX7dZ1nhmeagiueoVuyjJeFPhJ+qbL1XeMbi7m08yRfPatVv mtJbCldU5GU4qqF6l1A6nTL5eIBFITFS99XyoVmvnrPLcLtXO6YIvsOAnZKp7TpAaizL970qOTmQs BGrcBCBGfw8opXs4UgQ0Uz3L+VP+R094Oe5v2M237xVDqUMKBBPbut6YyG2X9ckQKIcUXYTDpw69d yrreUWVy685cPxzl257KwlRdQ3qs82JtPz/mFyzsXrxrnot403sLGQMtFlk8erNPUUWHcVrxVwu+5 KB6vrgdUvm1Z7MkTFFJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8fec-003ku3-2a; Mon, 12 Jun 2023 11:24:10 +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 1q8feX-003kpy-2l for linux-amlogic@lists.infradead.org; Mon, 12 Jun 2023 11:24:07 +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 F2CEA6606E9D; Mon, 12 Jun 2023 12:24:00 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686569041; bh=cBP6h0Qj6xzi3ai4GIcJimJ3/B31KfrcJ0WCXAN8SKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CKsga2UY5qkVj7HGWMbLxQLWmXmQrpAYewgxB3/bBuCrjjkXgQVssiPXceqGlBuK0 PuroSuBmGX8TV0DxDBYWemQypis+HP9pMCRE9UuLqD9O6rCssEhrSqM/TEsfqaf2po s6wb+X0W9215nBGKLkyKtIPOPyix2HehAC0ah4/nhp4fhIC7tTfm686YF+NBmdeOji /5CTsJjf9EgDaQz8TI3b7F7+oOTK+t/oK0A+D1TqROF7QShpwofs3NYX471UBCQNHa VGN2g3nFZLZQa1nvL07TE1K0QsBPgUULykkCVON+8EXiXgxH2c6XAHiQ5ET8as4HM/ Zo89QxXeDrTcg== 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 v2 2/3] dw-hdmi: truly enforce 420-only formats when drm mode demands it Date: Mon, 12 Jun 2023 12:23:53 +0100 Message-Id: <20230612112354.4034489-3-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230612112354.4034489-1-adrian.larumbe@collabora.com> References: <20230612112354.4034489-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-20230612_042406_071264_82C52055 X-CRM114-Status: UNSURE ( 9.35 ) 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 --- 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 e6a456b72610..3a788316e2e5 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 Mon Jun 12 11:23:54 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: 13276378 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 80476C7EE43 for ; Mon, 12 Jun 2023 11:24:34 +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=VCDj2L/cR1MSnAThoDQOCK/8Mmr2Bc8fqFQRUWjadmA=; b=thtU4Aco4DEe6J vv15WdAOz7iuZQ7tCkFupzax3cAzl69Hqi5C0cxQt9URqEJogr2sFUN15dhBENZcIpbBjIyl/57S9 qCtxCP3DH81FH/Vsr1OcFhJ8kx5pcF9F5wI2Sd+PZRv6r7YQNhBhCkOuXyNhnTXX9vCEkBxhvI2ch zIjpc2NvdCbJ2s6sL2QWWxyn7sWLSNUySzDidR/8AHWYBWJEQaDkDgeB2k5jITJTiA5IwXrmt7OZg j8Y4SwKdU5hkg5JnmIlhM1Jg3o9bxuwVO9mtnkS+898+aSGVHlZ5YH/9sWtTSBjMfCCaWwAONYlhx NJY10FXkvxNmEFkjTjow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8fed-003kua-1p; Mon, 12 Jun 2023 11:24:11 +0000 Received: from madras.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e5ab]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q8feX-003kq0-2y for linux-amlogic@lists.infradead.org; Mon, 12 Jun 2023 11:24:07 +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 2B2146606EAD; Mon, 12 Jun 2023 12:24:01 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686569041; bh=yqMqNpyHVkgq4WKh8+eF7oS6FS05FaX9Qi/K1pSkMuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OZHBoW7A24+wIOKow0V9M960YH+OEywS/jyGMDkYZY+j+VK16dDREqWGBp29SHtJn 44g56TQBAfs7qppulTdDUxbsrLjZPAC4+EBoUUDKaamzuTKGeorWLbfz1jE5EtKZRD hcCo2YG4UgfFGGBTxR/7YKD8lcSeGcp6IUcex381o8sPqtqNycQFCKupOch3+tczdv dYG8EB0mPGFvJ6RxGmN7P1f+LZT++iYxAkVccluj1bNo5r4y+raoqa6DJQBv4tVaJi KwQdDl/tK6QX/s0JQcfv7k4rtkv7Xc1giI9MD9AHybRbzYGKc88VPrZ/5n2leqVN+M 3SwQt8tw7lh8Q== 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 v2 3/3] dw-hdmi: remove dead code and fix indentation Date: Mon, 12 Jun 2023 12:23:54 +0100 Message-Id: <20230612112354.4034489-4-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230612112354.4034489-1-adrian.larumbe@collabora.com> References: <20230612112354.4034489-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-20230612_042406_115049_C3EBEB31 X-CRM114-Status: UNSURE ( 8.64 ) 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 hdmi_datamap enum is no longer in use. Also reindent enable_audio's call params. Signed-off-by: Adrián Larumbe --- 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 3a788316e2e5..69c0e80b8525 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)