[PATCH 3/3] vcodec: mediatek: Add probe-defer for MTK IOMMU and SMI
From: Yong Wu
Date: Tue Jul 19 2016 - 23:02:48 EST
Mediatek V4l2 depend on the IOMMU and SMI. we should add probe-defer
to wait for the IOMMU and SMI is ready.
Signed-off-by: Yong Wu <yong.wu@xxxxxxxxxxxx>
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
index 4c977b2..9e6203e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
@@ -66,6 +66,11 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev)
pdev = mtkdev->plat_dev;
pm->dev = &pdev->dev;
+ /* Wait until MTK IOMMU and SMI probe done.*/
+ if (!mtk_smi_larb_is_ready(pm->larbvenc) ||
+ !mtk_smi_larb_is_ready(pm->larbvenclt))
+ return -EPROBE_DEFER;
+
pm->vencpll_d2 = devm_clk_get(&pdev->dev, "venc_sel_src");
if (IS_ERR(pm->vencpll_d2)) {
mtk_v4l2_err("devm_clk_get vencpll_d2 fail");
--
1.8.1.1.dirty