drm/bridge: tc358768: Use dev for dbg prints, not priv->dev
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Wed, 6 Sep 2023 06:50:55 +0000 (09:50 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:51:59 +0000 (11:51 +0100)
[ Upstream commit 89cfd50e13f1bead4350998a3a77422bef1ee0a5 ]

Simplify the code by capturing the priv->dev value to dev variable, and
use it.

Reviewed-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Tested-by: Maxim Schwalm <maxim.schwalm@gmail.com> # Asus TF700T
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230906-tc358768-v4-8-31725f008a50@ideasonboard.com
Stable-dep-of: f1dabbe64506 ("drm/bridge: tc358768: Fix tc358768_ns_to_cnt()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/bridge/tc358768.c

index 770f37a0a521830ab470369522854f51ece21460..130b80792601749a7bdc9083d1fe621447e7a410 100644 (file)
@@ -652,9 +652,10 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)
        const u32 internal_delay = 40;
        int ret, i;
        struct videomode vm;
+       struct device *dev = priv->dev;
 
        if (mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) {
-               dev_warn_once(priv->dev, "Non-continuous mode unimplemented, falling back to continuous\n");
+               dev_warn_once(dev, "Non-continuous mode unimplemented, falling back to continuous\n");
                mode_flags &= ~MIPI_DSI_CLOCK_NON_CONTINUOUS;
        }
 
@@ -662,7 +663,7 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)
 
        ret = tc358768_sw_reset(priv);
        if (ret) {
-               dev_err(priv->dev, "Software reset failed: %d\n", ret);
+               dev_err(dev, "Software reset failed: %d\n", ret);
                tc358768_hw_disable(priv);
                return;
        }
@@ -670,7 +671,7 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)
        mode = &bridge->encoder->crtc->state->adjusted_mode;
        ret = tc358768_setup_pll(priv, mode);
        if (ret) {
-               dev_err(priv->dev, "PLL setup failed: %d\n", ret);
+               dev_err(dev, "PLL setup failed: %d\n", ret);
                tc358768_hw_disable(priv);
                return;
        }
@@ -710,7 +711,7 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)
                data_type = MIPI_DSI_PACKED_PIXEL_STREAM_16;
                break;
        default:
-               dev_err(priv->dev, "Invalid data format (%u)\n",
+               dev_err(dev, "Invalid data format (%u)\n",
                        dsi_dev->format);
                tc358768_hw_disable(priv);
                return;
@@ -734,65 +735,65 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)
                                  dsibclk);
        dsiclk_nsk = (u32)div_u64((u64)1000000000 * TC358768_PRECISION, dsiclk);
        ui_nsk = dsiclk_nsk / 2;
-       dev_dbg(priv->dev, "dsiclk_nsk: %u\n", dsiclk_nsk);
-       dev_dbg(priv->dev, "ui_nsk: %u\n", ui_nsk);
-       dev_dbg(priv->dev, "dsibclk_nsk: %u\n", dsibclk_nsk);
+       dev_dbg(dev, "dsiclk_nsk: %u\n", dsiclk_nsk);
+       dev_dbg(dev, "ui_nsk: %u\n", ui_nsk);
+       dev_dbg(dev, "dsibclk_nsk: %u\n", dsibclk_nsk);
 
        /* LP11 > 100us for D-PHY Rx Init */
        val = tc358768_ns_to_cnt(100 * 1000, dsibclk_nsk) - 1;
-       dev_dbg(priv->dev, "LINEINITCNT: %u\n", val);
+       dev_dbg(dev, "LINEINITCNT: %u\n", val);
        tc358768_write(priv, TC358768_LINEINITCNT, val);
 
        /* LPTimeCnt > 50ns */
        val = tc358768_ns_to_cnt(50, dsibclk_nsk) - 1;
        lptxcnt = val;
-       dev_dbg(priv->dev, "LPTXTIMECNT: %u\n", val);
+       dev_dbg(dev, "LPTXTIMECNT: %u\n", val);
        tc358768_write(priv, TC358768_LPTXTIMECNT, val);
 
        /* 38ns < TCLK_PREPARE < 95ns */
        val = tc358768_ns_to_cnt(65, dsibclk_nsk) - 1;
-       dev_dbg(priv->dev, "TCLK_PREPARECNT %u\n", val);
+       dev_dbg(dev, "TCLK_PREPARECNT %u\n", val);
        /* TCLK_PREPARE + TCLK_ZERO > 300ns */
        val2 = tc358768_ns_to_cnt(300 - tc358768_to_ns(2 * ui_nsk),
                                  dsibclk_nsk) - 2;
-       dev_dbg(priv->dev, "TCLK_ZEROCNT %u\n", val2);
+       dev_dbg(dev, "TCLK_ZEROCNT %u\n", val2);
        val |= val2 << 8;
        tc358768_write(priv, TC358768_TCLK_HEADERCNT, val);
 
        /* 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: %u\n", val);
+       dev_dbg(dev, "TCLK_TRAILCNT: %u\n", val);
        tc358768_write(priv, TC358768_TCLK_TRAILCNT, val);
 
        /* 40ns + 4*UI < THS_PREPARE < 85ns + 6*UI */
        val = 50 + tc358768_to_ns(4 * ui_nsk);
        val = tc358768_ns_to_cnt(val, dsibclk_nsk) - 1;
-       dev_dbg(priv->dev, "THS_PREPARECNT %u\n", val);
+       dev_dbg(dev, "THS_PREPARECNT %u\n", val);
        /* THS_PREPARE + THS_ZERO > 145ns + 10*UI */
        raw_val = tc358768_ns_to_cnt(145 - tc358768_to_ns(3 * ui_nsk), dsibclk_nsk) - 10;
        val2 = clamp(raw_val, 0, 127);
-       dev_dbg(priv->dev, "THS_ZEROCNT %u\n", val2);
+       dev_dbg(dev, "THS_ZEROCNT %u\n", val2);
        val |= val2 << 8;
        tc358768_write(priv, TC358768_THS_HEADERCNT, val);
 
        /* TWAKEUP > 1ms in lptxcnt steps */
        val = tc358768_ns_to_cnt(1020000, dsibclk_nsk);
        val = val / (lptxcnt + 1) - 1;
-       dev_dbg(priv->dev, "TWAKEUP: %u\n", val);
+       dev_dbg(dev, "TWAKEUP: %u\n", val);
        tc358768_write(priv, TC358768_TWAKEUP, val);
 
        /* TCLK_POSTCNT > 60ns + 52*UI */
        val = tc358768_ns_to_cnt(60 + tc358768_to_ns(52 * ui_nsk),
                                 dsibclk_nsk) - 3;
-       dev_dbg(priv->dev, "TCLK_POSTCNT: %u\n", val);
+       dev_dbg(dev, "TCLK_POSTCNT: %u\n", val);
        tc358768_write(priv, TC358768_TCLK_POSTCNT, val);
 
        /* max(60ns + 4*UI, 8*UI) < THS_TRAILCNT < 105ns + 12*UI */
        raw_val = tc358768_ns_to_cnt(60 + tc358768_to_ns(18 * ui_nsk),
                                     dsibclk_nsk) - 4;
        val = clamp(raw_val, 0, 15);
-       dev_dbg(priv->dev, "THS_TRAILCNT: %u\n", val);
+       dev_dbg(dev, "THS_TRAILCNT: %u\n", val);
        tc358768_write(priv, TC358768_THS_TRAILCNT, val);
 
        val = BIT(0);
@@ -806,10 +807,10 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)
        /* TXTAGOCNT[26:16] RXTASURECNT[10:0] */
        val = tc358768_to_ns((lptxcnt + 1) * dsibclk_nsk * 4);
        val = tc358768_ns_to_cnt(val, dsibclk_nsk) / 4 - 1;
-       dev_dbg(priv->dev, "TXTAGOCNT: %u\n", val);
+       dev_dbg(dev, "TXTAGOCNT: %u\n", val);
        val2 = tc358768_ns_to_cnt(tc358768_to_ns((lptxcnt + 1) * dsibclk_nsk),
                                  dsibclk_nsk) - 2;
-       dev_dbg(priv->dev, "RXTASURECNT: %u\n", val2);
+       dev_dbg(dev, "RXTASURECNT: %u\n", val2);
        val = val << 16 | val2;
        tc358768_write(priv, TC358768_BTACNTRL1, val);
 
@@ -903,7 +904,7 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)
 
        ret = tc358768_clear_error(priv);
        if (ret) {
-               dev_err(priv->dev, "Bridge pre_enable failed: %d\n", ret);
+               dev_err(dev, "Bridge pre_enable failed: %d\n", ret);
                tc358768_bridge_disable(bridge);
                tc358768_bridge_post_disable(bridge);
        }