@@ -83,6 +83,21 @@ static void clean_irq_status(unsigned int irq_status, void __iomem *addr)
writel(MTK_VENC_IRQ_STATUS_FRM, addr);
}
+
+static int mtk_vcodec_enc_set_dma_mask(struct device *dev)
+{
+ int ret = 0;
+
+ return !(of_device_is_compatible(dev->of_node, "mediatek,mt8173-vcodec-dec") ||
+ of_device_is_compatible(dev->of_node, "mediatek,mt8183-vcodec-dec"));
+
+ ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(34));
+ if (ret)
+ mtk_v4l2_err("Failed to set enc mask");
+
+ return ret;
+}
+
static irqreturn_t mtk_vcodec_enc_irq_handler(int irq, void *priv)
{
struct mtk_vcodec_dev *dev = priv;
@@ -344,8 +359,9 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
goto err_event_workq;
}
- if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
+ ret = mtk_vcodec_enc_set_dma_mask(&pdev->dev);
+ if (ret)
+ goto err_event_workq;
ret = video_register_device(vfd_enc, VFL_TYPE_VIDEO, -1);
if (ret) {
After commit f1ad5338a4d5("of: Fix "dma-ranges" handling for bus controllers"), the dma-ranges is not allowed in encoder dts node. But the driver still need to set dma mask, remove "dma-ranges" condition in prob function. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> --- Reference series: [1]: v5 of this series is present by Yong Wu. 20230307023507.13306-1-yong.wu@mediatek.com --- .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)