From nobody Thu Apr 2 06:31:59 2026 Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4417C175A7B; Sun, 22 Mar 2026 17:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774198944; cv=none; b=aO+9mf/asbGbBLrFtjmKY+/l6krMwv00JDTTZMpEIre7u0ysXqS4TVi2s9OxW483aZQolqXSLFePY48h3LOxsSW6/FmYow/ezhWhZmf08Jh8KO/T9gSu7j9Wt58ssClUk+9IBIv4jcKABFQPgVIA4rMjTIYt4pyz5QF0uL/MEH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774198944; c=relaxed/simple; bh=iW7rNRh2ArJWOxm9/fuOocPIaTFuDAFc1tz6G/PVRKU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uxkJi5jmjwJrNM0/bggrgGWXBA20a0hpbUQkCsO4oo9UXtwsNEL6KZRbAtl2UskQ+JsPlI1HaijxXY8smY9qDGHWQ1gzEXPsUjdC8WvFPWAdIF8yq8Dj4D/fU7Onr20TFpSYH6ts1ckRDQIz0inZsMGSK5vXsq4DG3FnyLZRTvY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=Z65NM3eO; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="Z65NM3eO" Received: from [127.0.0.1] (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id D260B26E75; Sun, 22 Mar 2026 18:02:21 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id uLtavyJ539ik; Sun, 22 Mar 2026 18:02:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1774198940; bh=iW7rNRh2ArJWOxm9/fuOocPIaTFuDAFc1tz6G/PVRKU=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Z65NM3eObpu8kyaSTYSY8vm83xcXAschgnwWAP8aqijIT8g+lO+PO0AxfFkv4kKmr oxeVq8sEwLyWztt44CcSCrcsT8e6gQN7nHtrrJrnygWNO2u27Y3j7JDulv9SPllLpr EE8D6G2IFdCGBtLe6tIFEkfgFlubHag6jYCRJlzcInMOvH5C8lzkZNBdjHhFIuZKTv FiITvi3xRJ1xkXA/2S+U7WWRxEYwVcrbDV1uFBeIyyyURPbIwDREmRHSVS8pUB6LmB 7XO8hMVjcIy1k+IWlslTBM0oS3XKHsTYkl9w4frUSzIK0ZhQGx/9CUL85s3B0ObR+G 7E0TBy1lD4nyA== From: Kaustabh Chakraborty Date: Sun, 22 Mar 2026 22:32:06 +0530 Subject: [PATCH RESEND v2 1/2] drm/bridge: samsung-dsim: enable MFLUSH_VS for Exynos 7870 DSIM Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260322-exynos-dsim-fixes-v2-1-0069c9e1d9bf@disroot.org> References: <20260322-exynos-dsim-fixes-v2-0-0069c9e1d9bf@disroot.org> In-Reply-To: <20260322-exynos-dsim-fixes-v2-0-0069c9e1d9bf@disroot.org> To: Inki Dae , Jagan Teki , Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Kaustabh Chakraborty , stable@vger.kernel.org Commit a36c533ad3e1 ("drm/bridge: samsung-dsim: Always flush display FIFO on vsync pulse") intends to enable FIFO flushing at v-sync pulse by not setting the active-low MFLUSH_VS bit. However, in Exynos 7870 DSIM, the MFLUSH_VS bit is active-high. There is no publicly available documentation to the best of my knowledge, but downstream kernel code [1] supports this claim. Enable the bit for Exynos 7870. Cc: stable@vger.kernel.org # v6.17 and later Link: https://github.com/samsungexynos7870/android_kernel_samsung_exynos787= 0/blob/a3762bb1761ae/drivers/video/fbdev/exynos/decon_7870/dsim_reg_7870.c#= L699 [1] Tested-by: Marek Szyprowski Signed-off-by: Kaustabh Chakraborty --- drivers/gpu/drm/bridge/samsung-dsim.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge= /samsung-dsim.c index 1d85e706c74b9..70f8946ad3b24 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1089,6 +1089,13 @@ static int samsung_dsim_init_link(struct samsung_dsi= m *dsi) reg |=3D DSIM_HBP_DISABLE_MODE; if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_NO_HSA) reg |=3D DSIM_HSA_DISABLE_MODE; + + /* + * For some hardware types, DSIM_MFLUSH_VS bit needs to be + * enabled explicitly. + */ + if (dsi->plat_data->hw_type =3D=3D DSIM_TYPE_EXYNOS7870) + reg |=3D DSIM_MFLUSH_VS; } =20 if (dsi->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET) --=20 2.53.0 From nobody Thu Apr 2 06:31:59 2026 Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0E511B78F3 for ; Sun, 22 Mar 2026 17:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774198951; cv=none; b=Xkk1LBScKnJKY9p8VcZDpk6NuP6IKq2ioUP+A1rsWwc9o2PLHDZyCcJuS93Foh0/RfQ6QFsyzv/tOBScX9y/IP9yqZGU7IGfnhT/IsTAPO/cJ+xol0kntO4DTJG+FqzKkVhSaktpNx0l4yZZohRkOzdGfgF64ABruUOBadRHD2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774198951; c=relaxed/simple; bh=3sJl0Qt09rxEYSVKVcG7DazowGZnxFL0i9HaOoCC1Zk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JytNufMrbqNyJnTq2OX7C9FLVH23lwWAx/sa92hjGYOobRH+MoQjsUSMH2XE875A1q1Qdc9jsYHeMCEnCHDm5mWa1Ck5ZhGPqkzJ3RABcIisNzMttgYuYEn+3GbV/bb5F3t8wINSkdtiaVVqiOb3Cc6PZaL9wIWh2bhfUZydCDU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=J627CRo5; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="J627CRo5" Received: from [127.0.0.1] (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 3AA1B26F6F; Sun, 22 Mar 2026 18:02:28 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id VMgIJGJVi2Y4; Sun, 22 Mar 2026 18:02:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1774198947; bh=3sJl0Qt09rxEYSVKVcG7DazowGZnxFL0i9HaOoCC1Zk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=J627CRo5rJ/kANo8cUjAofAzB0QIFI1ADKBXA5ytq9UVNEtD06pzxlWCPDNKhkUmW +AAqJQRZ1aJetfKSu7oJTHO0pZkwxAQ/zy05LqOFTYJerr+j1fPSmOC4PsQKiFJq7d 2DMuHDNrsQ1e/dF0a/pwX7pFqSxkr5uFhgdeeU3KXne/RdLVOUMb6ds15w4wFmUjZy YpZBsL/M5TjCUmvId7nUgMT+M+M3DV6oGXyGNluw7Jw0QpgForCNqKbdjvZxUTg1lJ WKbcBzFzbl0MBpPYxGckecNgaIjyN/ZyUTHpWjbRUKCepDAnc4gycCeMECSmj4EmSA TfkQAkFhkdj6w== From: Kaustabh Chakraborty Date: Sun, 22 Mar 2026 22:32:07 +0530 Subject: [PATCH RESEND v2 2/2] drm/bridge: samsung-dsim: use DSIM interrupt to wait for PLL stability Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260322-exynos-dsim-fixes-v2-2-0069c9e1d9bf@disroot.org> References: <20260322-exynos-dsim-fixes-v2-0-0069c9e1d9bf@disroot.org> In-Reply-To: <20260322-exynos-dsim-fixes-v2-0-0069c9e1d9bf@disroot.org> To: Inki Dae , Jagan Teki , Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Kaustabh Chakraborty Stabilizing PLL needs to be waited for. This is done using a loop, checking the PLL_STABLE bit in the status register. DSIM fires an interrupt when the PLL is stabilized. Rely on this functionality for stabilization wait, getting rid of the implicit loop. This has been tested on a Galaxy J6 (Exynos 7870). Unfortunately, since testing on all supported devices is less feasible, introduce a stop-gap measure where the timeout has a gracious lower bound of 100 microseconds. This will (hopefully) prevent regressions due to timeout on other devices. Suggested-by: Inki Dae Link: https://lore.kernel.org/r/CAAQKjZMLMbwDVZRb5+Xb_5yz3AEP4uuzFJMuuZy9NF= Du13VU5w@mail.gmail.com Tested-by: Marek Szyprowski Signed-off-by: Kaustabh Chakraborty --- drivers/gpu/drm/bridge/samsung-dsim.c | 41 +++++++++++++++++++++++--------= ---- include/drm/bridge/samsung-dsim.h | 1 + 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge= /samsung-dsim.c index 70f8946ad3b24..0ca6c6484c9a6 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -788,7 +789,7 @@ static unsigned long samsung_dsim_set_pll(struct samsun= g_dsim *dsi, { const struct samsung_dsim_driver_data *driver_data =3D dsi->driver_data; unsigned long fin, fout; - int timeout; + unsigned int timeout; u8 p, s; u16 m; u32 reg; @@ -849,19 +850,26 @@ static unsigned long samsung_dsim_set_pll(struct sams= ung_dsim *dsi, if (dsi->swap_dn_dp_data) reg |=3D DSIM_PLL_DPDNSWAP_DAT; =20 + /* + * The PLL_TIMER value is the product of the timeout delay and the APB + * bus clock rate. Calcutate the timeout delay on-the-fly here. + * It is assumed that the bus clock is the first clock in the provided + * bulk clock data. + */ + timeout =3D 100; + fin =3D clk_get_rate(dsi->driver_data->clk_data[0].clk) / HZ_PER_MHZ; + if (fin) + timeout =3D max(dsi->driver_data->reg_values[PLL_TIMER] / fin, + timeout); + + reinit_completion(&dsi->pll_stabilized); samsung_dsim_write(dsi, DSIM_PLLCTRL_REG, reg); =20 - timeout =3D 3000; - do { - if (timeout-- =3D=3D 0) { - dev_err(dsi->dev, "PLL failed to stabilize\n"); - return 0; - } - if (driver_data->has_legacy_status_reg) - reg =3D samsung_dsim_read(dsi, DSIM_STATUS_REG); - else - reg =3D samsung_dsim_read(dsi, DSIM_LINK_STATUS_REG); - } while ((reg & BIT(driver_data->pll_stable_bit)) =3D=3D 0); + if (wait_for_completion_timeout(&dsi->pll_stabilized, + usecs_to_jiffies(timeout))) { + dev_err(dsi->dev, "PLL failed to stabilize\n"); + return 0; + } =20 dsi->hs_clock =3D fout; =20 @@ -1596,8 +1604,12 @@ static irqreturn_t samsung_dsim_irq(int irq, void *d= ev_id) return IRQ_HANDLED; } =20 - if (!(status & (DSIM_INT_RX_DONE | DSIM_INT_SFR_FIFO_EMPTY | - DSIM_INT_PLL_STABLE))) + if (status & DSIM_INT_PLL_STABLE) { + complete(&dsi->pll_stabilized); + return IRQ_HANDLED; + } + + if (!(status & (DSIM_INT_RX_DONE | DSIM_INT_SFR_FIFO_EMPTY))) return IRQ_HANDLED; =20 if (samsung_dsim_transfer_finish(dsi)) @@ -2146,6 +2158,7 @@ int samsung_dsim_probe(struct platform_device *pdev) return PTR_ERR(dsi); =20 init_completion(&dsi->completed); + init_completion(&dsi->pll_stabilized); spin_lock_init(&dsi->transfer_lock); INIT_LIST_HEAD(&dsi->transfer_list); =20 diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung= -dsim.h index 03005e474704b..e3433da21ad08 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -123,6 +123,7 @@ struct samsung_dsim { int state; struct drm_property *brightness; struct completion completed; + struct completion pll_stabilized; =20 spinlock_t transfer_lock; /* protects transfer_list */ struct list_head transfer_list; --=20 2.53.0