[PATCH v2 2/2] drm/mediatek: add devlink to cmdq dev
jason-jh.lin
jason-jh.lin at mediatek.com
Tue Nov 30 09:26:16 PST 2021
Add devlink to cmdq to make sure the order of suspend and resume
is correct.
Signed-off-by: jason-jh.lin <jason-jh.lin at 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 e886d299813c..98486f99043e 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;
}
@@ -905,6 +907,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),
@@ -972,6 +975,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 -NODEV;
+ }
+
ret = of_property_read_u32_index(priv->mutex_node,
"mediatek,gce-events",
i,
--
2.18.0
More information about the linux-arm-kernel
mailing list