Patch "drm/bridge: tc358768: fix TCLK_TRAILCNT computation" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/bridge: tc358768: fix TCLK_TRAILCNT computation

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-bridge-tc358768-fix-tclk_trailcnt-computation.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b3754f2dbf429eb626e0186a8127a6c97ec76c7f
Author: Francesco Dolcini <francesco.dolcini@xxxxxxxxxxx>
Date:   Thu Apr 27 16:29:30 2023 +0200

    drm/bridge: tc358768: fix TCLK_TRAILCNT computation
    
    [ Upstream commit ee18698e212b1659dd0850d7e2ae0f22e16ed3d3 ]
    
    Correct computation of TCLK_TRAILCNT register.
    
    The driver does not implement non-continuous clock mode, so the actual
    value doesn't make a practical difference yet. However this change also
    ensures that the value does not write to reserved registers bits in case
    of under/overflow.
    
    This register must be set to a value that ensures that
    
    TCLK-TRAIL > 60ns
     and
    TEOT <= (105 ns + 12 x UI)
    
    with the actual value of TCLK-TRAIL being
    
    (TCLK_TRAILCNT + (1 to 2)) xHSByteClkCycle +
     (2 + (1 to 2)) * HSBYTECLKCycle - (PHY output delay)
    
    with PHY output delay being about
    
    (2 to 3) x MIPIBitClk cycle in the BitClk conversion.
    
    Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver")
    Signed-off-by: Francesco Dolcini <francesco.dolcini@xxxxxxxxxxx>
    Reviewed-by: Robert Foss <rfoss@xxxxxxxxxx>
    Signed-off-by: Robert Foss <rfoss@xxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-2-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-3-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-4-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-5-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-2-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-3-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-4-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-5-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-2-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-3-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-4-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-5-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-2-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-3-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-4-francesco@xxxxxxxxxx
    Link: https://patchwork.freedesktop.org/patch/msgid/20230427142934.55435-5-francesco@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c
index f6c0300090ecd..b7372c5b0b819 100644
--- a/drivers/gpu/drm/bridge/tc358768.c
+++ b/drivers/gpu/drm/bridge/tc358768.c
@@ -10,6 +10,7 @@
 #include <linux/i2c.h>
 #include <linux/kernel.h>
 #include <linux/media-bus-format.h>
+#include <linux/minmax.h>
 #include <linux/module.h>
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
@@ -633,6 +634,7 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)
 	struct tc358768_priv *priv = bridge_to_tc358768(bridge);
 	struct mipi_dsi_device *dsi_dev = priv->output.dev;
 	u32 val, val2, lptxcnt, hact, data_type;
+	s32 raw_val;
 	const struct drm_display_mode *mode;
 	u32 dsibclk_nsk, dsiclk_nsk, ui_nsk, phy_delay_nsk;
 	u32 dsiclk, dsibclk;
@@ -733,9 +735,9 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)
 	dev_dbg(priv->dev, "TCLK_HEADERCNT: 0x%x\n", val);
 	tc358768_write(priv, TC358768_TCLK_HEADERCNT, val);
 
-	/* TCLK_TRAIL > 60ns + 3*UI */
-	val = 60 + tc358768_to_ns(3 * ui_nsk);
-	val = tc358768_ns_to_cnt(val, dsibclk_nsk) - 5;
+	/* TCLK_TRAIL > 60ns AND TEOT <= 105 ns + 12*UI */
+	raw_val = tc358768_ns_to_cnt(60 + tc358768_to_ns(2 * ui_nsk), dsibclk_nsk) - 5;
+	val = clamp(raw_val, 0, 127);
 	dev_dbg(priv->dev, "TCLK_TRAILCNT: 0x%x\n", val);
 	tc358768_write(priv, TC358768_TCLK_TRAILCNT, val);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux