diff mbox series

[v4] drm: bridge: samsung-dsim: Fix waiting for empty cmd transfer FIFO on older Exynos

Message ID 20230809145641.3213210-1-m.szyprowski@samsung.com (mailing list archive)
State Accepted
Headers show
Series [v4] drm: bridge: samsung-dsim: Fix waiting for empty cmd transfer FIFO on older Exynos | expand

Commit Message

Marek Szyprowski Aug. 9, 2023, 2:56 p.m. UTC
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 ("drm: bridge: samsung-dsim: Drain command transfer FIFO before transfer")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
v4:
- made has_broken_fifoctrl_emptyhdr a bitfield

v3:
- fixed 'fixes' tag, added reviewed-by

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/
---

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 <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(-)

Comments

Marek Vasut Aug. 9, 2023, 3:09 p.m. UTC | #1
On 8/9/23 16:56, Marek Szyprowski wrote:
> 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 ("drm: bridge: samsung-dsim: Drain command transfer FIFO before transfer")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Oh, nice, there is already a bitfield piece in place.

Thanks !

Reviewed-by: Marek Vasut <marex@denx.de>
Robert Foss Aug. 11, 2023, 12:59 p.m. UTC | #2
On Wed, 9 Aug 2023 16:56:41 +0200, Marek Szyprowski wrote:
> 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").
> 
> 
> [...]

Fixed formatting warning related to commit message syntax.

Applied, thanks!

[1/1] drm: bridge: samsung-dsim: Fix waiting for empty cmd transfer FIFO on older Exynos
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=15f389da1125



Rob
Marek Szyprowski Aug. 17, 2023, 6:06 a.m. UTC | #3
On 11.08.2023 14:59, Robert Foss wrote:
> On Wed, 9 Aug 2023 16:56:41 +0200, Marek Szyprowski wrote:
>> 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").
>>
>>
>> [...]
> Fixed formatting warning related to commit message syntax.
>
> Applied, thanks!

Thanks for applying it, but yesterday I've noticed that this patch has 
been dropped from linux-next for some unknown reasons. I also cannot 
find it in today's linux-next (next-20230817):

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/drivers/gpu/drm/bridge/samsung-dsim.c?h=next-20230817

Any idea what has happened?


Best regards
Neil Armstrong Aug. 17, 2023, 7:36 a.m. UTC | #4
On 17/08/2023 08:06, Marek Szyprowski wrote:
> On 11.08.2023 14:59, Robert Foss wrote:
>> On Wed, 9 Aug 2023 16:56:41 +0200, Marek Szyprowski wrote:
>>> 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").
>>>
>>>
>>> [...]
>> Fixed formatting warning related to commit message syntax.
>>
>> Applied, thanks!
> 
> Thanks for applying it, but yesterday I've noticed that this patch has
> been dropped from linux-next for some unknown reasons. I also cannot
> find it in today's linux-next (next-20230817):
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/drivers/gpu/drm/bridge/samsung-dsim.c?h=next-20230817
> 
> Any idea what has happened?

Rob applied it too late, the last drm-misc-next PR was sent before this patch was applied,
and the dim process (https://drm.pages.freedesktop.org/maintainer-tools/index.html) automatically
merges drm-misc-next-fixes instead of drm-misc-next after -rc6, drm-misc-next-fixes is aligned
with the last drm-misc-next PR before -rc6.

But the patch is still in drm-misc-next since it never closes

Neil


> 
> 
> Best regards
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
index c49091691ab1..35d29f6cd3e2 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -413,6 +413,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 = {
@@ -429,6 +430,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 = {
@@ -1010,8 +1012,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..6fc9bb2979e4 100644
--- a/include/drm/bridge/samsung-dsim.h
+++ b/include/drm/bridge/samsung-dsim.h
@@ -53,6 +53,7 @@  struct samsung_dsim_driver_data {
 	unsigned int plltmr_reg;
 	unsigned int has_freqband:1;
 	unsigned int has_clklane_stop:1;
+	unsigned int has_broken_fifoctrl_emptyhdr:1;
 	unsigned int num_clks;
 	unsigned int min_freq;
 	unsigned int max_freq;