mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunfei Dong <yunfei.dong@mediatek.com>
To: "Yunfei Dong" <yunfei.dong@mediatek.com>,
	"Chen-Yu Tsai" <wenst@chromium.org>,
	"Yong Wu" <yong.wu@mediatek.org>,
	"Nicolas Dufresne" <nicolas@ndufresne.ca>,
	"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
	"Nícolas F . R . A . Prado" <nfraprado@collabora.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Fritz Koenig <frkoenig@chromium.org>,
	Daniel Vetter <daniel@ffwll.ch>,
	Steve Cho <stevecho@chromium.org>, <linux-media@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: [PATCH 2/2] media: mediatek: vcodec: Remove encoder 'dma-ranges' conditon when set dma mask
Date: Thu, 23 Mar 2023 16:38:10 +0800	[thread overview]
Message-ID: <20230323083810.21912-2-yunfei.dong@mediatek.com> (raw)
In-Reply-To: <20230323083810.21912-1-yunfei.dong@mediatek.com>

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(-)

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
index 6961f66b5693..dda669d04c05 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
@@ -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) {
-- 
2.18.0


  reply	other threads:[~2023-03-23  8:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23  8:38 [PATCH 1/2] media: mediatek: vcodec: Remove decoder " Yunfei Dong
2023-03-23  8:38 ` Yunfei Dong [this message]
2023-03-23  8:50 ` AngeloGioacchino Del Regno
2023-03-23  9:13   ` Yong Wu (吴勇)
2023-03-24  9:19     ` Yong Wu (吴勇)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230323083810.21912-2-yunfei.dong@mediatek.com \
    --to=yunfei.dong@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=frkoenig@chromium.org \
    --cc=hsinyi@chromium.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nfraprado@collabora.com \
    --cc=nicolas@ndufresne.ca \
    --cc=stevecho@chromium.org \
    --cc=wenst@chromium.org \
    --cc=yong.wu@mediatek.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®