From patchwork Fri Jul 21 11:28:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 13321899 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 C44F8EB64DC for ; Fri, 21 Jul 2023 11:28:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7D5610E657; Fri, 21 Jul 2023 11:28:47 +0000 (UTC) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8F49E10E658 for ; Fri, 21 Jul 2023 11:28:45 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230721112843euoutp011b2b9f67e752f19452102671ca635575~z3n9YfpUI1907519075euoutp01L for ; Fri, 21 Jul 2023 11:28:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230721112843euoutp011b2b9f67e752f19452102671ca635575~z3n9YfpUI1907519075euoutp01L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1689938923; bh=IQ043OEurud0+gvH+yRscrI4GAiKGvwDZ/BhQEd7gGA=; h=From:To:Cc:Subject:Date:References:From; b=tZs+g5U4Scp2LNC3TuVt2w+KyqOlwDb3jciTJDF0NgAyPtcUlp3l2d0p+UpC/dEp9 BG2P1V6eR1whvwEN6VVtlMH+oB5eERTkeJ26K+SxRWqysVVuaM73k01vv+kWRfFBvg RdcyOqz6qp7+Euo9k7s+QKHIrgHQ8X+kZv/p5OVA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230721112843eucas1p27bb2702982eb9b7e5c043e41f1cf5051~z3n9Dy3OJ1162011620eucas1p2m; Fri, 21 Jul 2023 11:28:43 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 18.1A.42423.BEB6AB46; Fri, 21 Jul 2023 12:28:43 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230721112842eucas1p2071651599fd2b86792b84aa3770fba67~z3n8mno_H1162011620eucas1p2l; Fri, 21 Jul 2023 11:28:42 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230721112842eusmtrp1d4d4d54e7f7e49570fce8ad28fba9254~z3n8l_kWR2971729717eusmtrp1V; Fri, 21 Jul 2023 11:28:42 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-ad-64ba6beb3dda Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C1.CA.10549.AEB6AB46; Fri, 21 Jul 2023 12:28:42 +0100 (BST) Received: from AMDC4653.eu.corp.samsungelectronics.net (unknown [106.120.51.32]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230721112842eusmtip13ae7603ecc127760410db400046750f1~z3n76JZTc1394613946eusmtip1M; Fri, 21 Jul 2023 11:28:42 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org Subject: [PATCH v2] drm: bridge: samsung-dsim: Fix waiting for empty cmd transfer FIFO on older Exynos Date: Fri, 21 Jul 2023 13:28:32 +0200 Message-Id: <20230721112832.2273167-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.34.1 MIME-Version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pxtUJWRuWWxSvM0x LUr4ucLNKRpb10xeX+RZ0ljx5v8np/nnT0WcP8fCHfHvOf8+kb7NhQoy6VNvvLnS+iVFcU70 7DWyNndf5yuG7mZuu7KwN2ke7wz9vPB/EYx/lViKMxINtZiLihMBUgvkJzIDAAA= X-CMS-MailID: 20230721112842eucas1p2071651599fd2b86792b84aa3770fba67 X-Msg-Generator: CA X-RootMTR: 20230721112842eucas1p2071651599fd2b86792b84aa3770fba67 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230721112842eucas1p2071651599fd2b86792b84aa3770fba67 References: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Neil Armstrong , Robert Foss , Jonas Karlman , Laurent Pinchart , Jernej Skrabec , Tomasz Figa , Jagan Teki , Andrzej Hajda , Marek Szyprowski Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Samsung DSIM used in older Exynos SoCs (like Exynos 4210, 4x12, 3250) doesn't report empty level of packer header FIFO. In case of those SoCs, use the old way of waiting for empty command tranfsfer FIFO, removed recently by commit 14806c641582 ("Drain command transfer FIFO before transfer"). Fixes: 14806c641582 ("Drain command transfer FIFO before transfer") Signed-off-by: Marek Szyprowski Reviewed-by: Marek Vasut --- v2: - added additional delay when workaround is used as suggested by Marek Vasut v1: https://lore.kernel.org/all/20230718131859.3114135-1-m.szyprowski@samsung.com/ --- drivers/gpu/drm/bridge/samsung-dsim.c | 18 ++++++++++++++++-- include/drm/bridge/samsung-dsim.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 9b7a00bafeaa..d06401de637c 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -412,6 +412,7 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .m_min = 41, .m_max = 125, .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, }; static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { @@ -428,6 +429,7 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { .m_min = 41, .m_max = 125, .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, }; static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { @@ -1009,8 +1011,20 @@ static int samsung_dsim_wait_for_hdr_fifo(struct samsung_dsim *dsi) do { u32 reg = samsung_dsim_read(dsi, DSIM_FIFOCTRL_REG); - if (reg & DSIM_SFR_HEADER_EMPTY) - return 0; + if (!dsi->driver_data->has_broken_fifoctrl_emptyhdr) { + if (reg & DSIM_SFR_HEADER_EMPTY) + return 0; + } else { + if (!(reg & DSIM_SFR_HEADER_FULL)) { + /* + * Wait a little bit, so the pending data can + * actually leave the FIFO to avoid overflow. + */ + if (!cond_resched()) + usleep_range(950, 1050); + return 0; + } + } if (!cond_resched()) usleep_range(950, 1050); diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index 05100e91ecb9..18017b3e5d9e 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -62,6 +62,7 @@ struct samsung_dsim_driver_data { const unsigned int *reg_values; u16 m_min; u16 m_max; + unsigned int has_broken_fifoctrl_emptyhdr; }; struct samsung_dsim_host_ops {