* [PATCH v3 0/2] Fix mediatek-drm suspend and resume issue
@ 2021-11-30 18:15 jason-jh.lin
2021-11-30 18:15 ` [PATCH v3 1/2] drm/mediatek: add blocking config mode for crtc disable flow jason-jh.lin
2021-11-30 18:15 ` [PATCH v3 2/2] drm/mediatek: add devlink to cmdq dev jason-jh.lin
0 siblings, 2 replies; 3+ messages in thread
From: jason-jh.lin @ 2021-11-30 18:15 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, Matthias Brugger, tzungbi
Cc: David Airlie, Daniel Vetter, dri-devel, linux-mediatek,
linux-arm-kernel, linux-kernel, hsinyi, fshao, nancy.lin,
singo.chang, jason-jh.lin
Change in v3:
- fix return typo: modify -NOEDV to -ENODEV.
- add missing complete function in ddp_cmdq_cb.
Change in v2:
- rollback adding cmdq_mbox_flush in cmdq_suspend and add
blocking config mode for mtk_drm_crtc_atomic_disable.
- add return error when device_link_add fail.
- change the first parameter of device_link_add from dev
to priv->dev.
jason-jh.lin (2):
drm/mediatek: add blocking config mode for crtc disable flow
drm/mediatek: add devlink to cmdq dev
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 31 ++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v3 1/2] drm/mediatek: add blocking config mode for crtc disable flow
2021-11-30 18:15 [PATCH v3 0/2] Fix mediatek-drm suspend and resume issue jason-jh.lin
@ 2021-11-30 18:15 ` jason-jh.lin
2021-11-30 18:15 ` [PATCH v3 2/2] drm/mediatek: add devlink to cmdq dev jason-jh.lin
1 sibling, 0 replies; 3+ messages in thread
From: jason-jh.lin @ 2021-11-30 18:15 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, Matthias Brugger, tzungbi
Cc: David Airlie, Daniel Vetter, dri-devel, linux-mediatek,
linux-arm-kernel, linux-kernel, hsinyi, fshao, nancy.lin,
singo.chang, jason-jh.lin
mtk_drm_crtc_atomic_disable will send an async cmd to cmdq driver,
so it may not finish when cmdq_suspend is called sometimes.
Change async cmd to blocking cmd for mtk_drm_crtc_atomic_disable
to make sure the lastest cmd is done before cmdq_suspend.
Signed-off-by: jason-jh.lin <jason-jh.lin@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 62529a954b62..6ca96802fd77 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -56,6 +56,8 @@ struct mtk_drm_crtc {
struct cmdq_pkt cmdq_handle;
u32 cmdq_event;
u32 cmdq_vblank_cnt;
+ bool blocking_config;
+ struct completion cmplt;
#endif
struct device *mmsys_dev;
@@ -314,6 +316,9 @@ static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg)
}
mtk_crtc->cmdq_vblank_cnt = 0;
+
+ if (mtk_crtc->blocking_config)
+ complete(&mtk_crtc->cmplt);
}
#endif
@@ -584,8 +589,16 @@ static void mtk_drm_crtc_update_config(struct mtk_drm_crtc *mtk_crtc,
*/
mtk_crtc->cmdq_vblank_cnt = 3;
+ if (mtk_crtc->blocking_config)
+ init_completion(&mtk_crtc->cmplt);
+
mbox_send_message(mtk_crtc->cmdq_client.chan, cmdq_handle);
mbox_client_txdone(mtk_crtc->cmdq_client.chan, 0);
+
+ if (mtk_crtc->blocking_config) {
+ wait_for_completion(&mtk_crtc->cmplt);
+ mtk_crtc->blocking_config = false;
+ }
}
#endif
mtk_crtc->config_updating = false;
@@ -698,7 +711,9 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
plane_state->pending.config = true;
}
mtk_crtc->pending_planes = true;
-
+#if IS_REACHABLE(CONFIG_MTK_CMDQ)
+ mtk_crtc->blocking_config = true;
+#endif
mtk_drm_crtc_update_config(mtk_crtc, false);
/* Wait for planes to be disabled */
drm_crtc_wait_one_vblank(crtc);
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v3 2/2] drm/mediatek: add devlink to cmdq dev
2021-11-30 18:15 [PATCH v3 0/2] Fix mediatek-drm suspend and resume issue jason-jh.lin
2021-11-30 18:15 ` [PATCH v3 1/2] drm/mediatek: add blocking config mode for crtc disable flow jason-jh.lin
@ 2021-11-30 18:15 ` jason-jh.lin
1 sibling, 0 replies; 3+ messages in thread
From: jason-jh.lin @ 2021-11-30 18:15 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, Matthias Brugger, tzungbi
Cc: David Airlie, Daniel Vetter, dri-devel, linux-mediatek,
linux-arm-kernel, linux-kernel, hsinyi, fshao, nancy.lin,
singo.chang, jason-jh.lin
Add devlink to cmdq to make sure the order of suspend and resume
is correct.
Signed-off-by: jason-jh.lin <jason-jh.lin@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 6ca96802fd77..88b57a20f26d 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -61,6 +61,7 @@ struct mtk_drm_crtc {
#endif
struct device *mmsys_dev;
+ struct device *drm_dev;
struct mtk_mutex *mutex;
unsigned int ddp_comp_nr;
struct mtk_ddp_comp **ddp_comp;
@@ -160,6 +161,7 @@ static void mtk_drm_crtc_destroy(struct drm_crtc *crtc)
mtk_drm_cmdq_pkt_destroy(&mtk_crtc->cmdq_handle);
if (mtk_crtc->cmdq_client.chan) {
+ device_link_remove(mtk_crtc->drm_dev, mtk_crtc->cmdq_client.chan->mbox->dev);
mbox_free_channel(mtk_crtc->cmdq_client.chan);
mtk_crtc->cmdq_client.chan = NULL;
}
@@ -908,6 +910,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
return -ENOMEM;
mtk_crtc->mmsys_dev = priv->mmsys_dev;
+ mtk_crtc->drm_dev = priv->dev;
mtk_crtc->ddp_comp_nr = path_len;
mtk_crtc->ddp_comp = devm_kmalloc_array(dev, mtk_crtc->ddp_comp_nr,
sizeof(*mtk_crtc->ddp_comp),
@@ -975,6 +978,17 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
}
if (mtk_crtc->cmdq_client.chan) {
+ struct device_link *link;
+
+ /* add devlink to cmdq dev to make sure suspend/resume order is correct */
+ link = device_link_add(priv->dev, mtk_crtc->cmdq_client.chan->mbox->dev,
+ DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+ if (!link) {
+ dev_err(priv->dev, "Unable to link dev=%s\n",
+ dev_name(mtk_crtc->cmdq_client.chan->mbox->dev));
+ return -ENODEV;
+ }
+
ret = of_property_read_u32_index(priv->mutex_node,
"mediatek,gce-events",
i,
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-30 18:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 18:15 [PATCH v3 0/2] Fix mediatek-drm suspend and resume issue jason-jh.lin
2021-11-30 18:15 ` [PATCH v3 1/2] drm/mediatek: add blocking config mode for crtc disable flow jason-jh.lin
2021-11-30 18:15 ` [PATCH v3 2/2] drm/mediatek: add devlink to cmdq dev jason-jh.lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).