[PATCH v2] drm: bridge: samsung-dsim: Fix waiting for empty cmd transfer FIFO on older Exynos
Fabio Estevam
festevam at gmail.com
Fri Jul 21 20:46:27 UTC 2023
On Fri, Jul 21, 2023 at 8:28 AM Marek Szyprowski
<m.szyprowski at samsung.com> 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 ("Drain command transfer FIFO before transfer")
Nitpick: the Subject of the commit log is not complete.
Fixes: 14806c641582 ("drm: bridge: samsung-dsim: Drain command
transfer FIFO before transfer")
> Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
> ---
> 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 {
> --
> 2.34.1
>
More information about the dri-devel
mailing list