Merge tag 'mediatek-drm-fixes-6.0' of https://git.kernel.org/pub/scm/linux/kernel...
authorDave Airlie <airlied@redhat.com>
Fri, 23 Sep 2022 03:15:29 +0000 (13:15 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 23 Sep 2022 03:15:34 +0000 (13:15 +1000)
Mediatek DRM Fixes for Linux 6.0

1. dsi: Add atomic {destroy,duplicate}_state, reset callbacks
2. drm/mediatek: Fix wrong dither settings
3. dsi: Move mtk_dsi_stop() call back to mtk_dsi_poweroff()

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220921235624.23580-1-chunkuang.hu@kernel.org
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
drivers/gpu/drm/mediatek/mtk_dsi.c

index 2d72cc5..6b6d533 100644 (file)
@@ -157,7 +157,7 @@ static void mtk_dither_config(struct device *dev, unsigned int w,
 {
        struct mtk_ddp_comp_dev *priv = dev_get_drvdata(dev);
 
-       mtk_ddp_write(cmdq_pkt, h << 16 | w, &priv->cmdq_reg, priv->regs, DISP_REG_DITHER_SIZE);
+       mtk_ddp_write(cmdq_pkt, w << 16 | h, &priv->cmdq_reg, priv->regs, DISP_REG_DITHER_SIZE);
        mtk_ddp_write(cmdq_pkt, DITHER_RELAY_MODE, &priv->cmdq_reg, priv->regs,
                      DISP_REG_DITHER_CFG);
        mtk_dither_set_common(priv->regs, &priv->cmdq_reg, bpc, DISP_REG_DITHER_CFG,
index 9cc406e..3b7d130 100644 (file)
@@ -685,6 +685,16 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
        if (--dsi->refcount != 0)
                return;
 
+       /*
+        * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since
+        * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(),
+        * which needs irq for vblank, and mtk_dsi_stop() will disable irq.
+        * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(),
+        * after dsi is fully set.
+        */
+       mtk_dsi_stop(dsi);
+
+       mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500);
        mtk_dsi_reset_engine(dsi);
        mtk_dsi_lane0_ulp_mode_enter(dsi);
        mtk_dsi_clk_ulp_mode_enter(dsi);
@@ -735,17 +745,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
        if (!dsi->enabled)
                return;
 
-       /*
-        * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since
-        * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(),
-        * which needs irq for vblank, and mtk_dsi_stop() will disable irq.
-        * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(),
-        * after dsi is fully set.
-        */
-       mtk_dsi_stop(dsi);
-
-       mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500);
-
        dsi->enabled = false;
 }
 
@@ -808,10 +807,13 @@ static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
 
 static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
        .attach = mtk_dsi_bridge_attach,
+       .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
        .atomic_disable = mtk_dsi_bridge_atomic_disable,
+       .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
        .atomic_enable = mtk_dsi_bridge_atomic_enable,
        .atomic_pre_enable = mtk_dsi_bridge_atomic_pre_enable,
        .atomic_post_disable = mtk_dsi_bridge_atomic_post_disable,
+       .atomic_reset = drm_atomic_helper_bridge_reset,
        .mode_set = mtk_dsi_bridge_mode_set,
 };