From patchwork Thu Mar 23 08:38:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 666809 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D44DC74A5B for ; Thu, 23 Mar 2023 08:40:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231217AbjCWIkD (ORCPT ); Thu, 23 Mar 2023 04:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231142AbjCWIjm (ORCPT ); Thu, 23 Mar 2023 04:39:42 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96B19199D0; Thu, 23 Mar 2023 01:38:17 -0700 (PDT) X-UUID: 0cb96ec6c95611eda9a90f0bb45854f4-20230323 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=02p1XoxXrLuMUBe0CjfZAi7psUBwCDsTusscQOeN2kU=; b=f7OnHpUTpnNP2fcPBRIzEyK+L9PK3z9SuDMmPWX+fP5JRvjL5ooT4NXfnR5KMCo65A82uTp3zJUS0djdFwCkl3irZ5Ny5n6wUMai7egSB5h+ItPSPZY/KEaTZDi1fe1o5bNVZMTfL02IrkXgMezR81uPLRtr2zpnZrijoflHnP4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22, REQID:200f4d0d-4c03-434f-adf7-4c937266cde6, IP:0, U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:120426c, CLOUDID:dcde21b4-beed-4dfc-bd9c-e1b22fa6ccc4, B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: 0cb96ec6c95611eda9a90f0bb45854f4-20230323 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1510370815; Thu, 23 Mar 2023 16:38:13 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Thu, 23 Mar 2023 16:38:12 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Thu, 23 Mar 2023 16:38:11 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Yong Wu , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , =?utf-8?q?N=C3=ADcolas?= =?utf-8?q?_F_=2E_R_=2E_A_=2E_Prado?= CC: Matthias Brugger , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH 1/2] media: mediatek: vcodec: Remove decoder 'dma-ranges' conditon when set dma mask Date: Thu, 23 Mar 2023 16:38:09 +0800 Message-ID: <20230323083810.21912-1-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org After commit f1ad5338a4d5("of: Fix "dma-ranges" handling for bus controllers"), the dma-ranges is not allowed in decoder dts node. But the driver still need to set dma mask, remove "dma-ranges" condition in prob function. Signed-off-by: Yunfei Dong --- Reference series: [1]: v5 of this series is present by Yong Wu. 20230307023507.13306-1-yong.wu@mediatek.com --- .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index bba7b932f4fa..2c3a4c2cdaee 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -137,6 +137,20 @@ static int mtk_vcodec_init_dec_resources(struct mtk_vcodec_dev *dev) return 0; } +static int mtk_vcodec_dec_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 dec mask"); + + return ret; +} + static int fops_vcodec_open(struct file *file) { struct mtk_vcodec_dev *dev = video_drvdata(file); @@ -323,13 +337,9 @@ static int mtk_vcodec_probe(struct platform_device *pdev) } } - if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL)) { - ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34)); - if (ret) { - mtk_v4l2_err("Failed to set mask"); - goto err_core_workq; - } - } + ret = mtk_vcodec_dec_set_dma_mask(&pdev->dev); + if (ret) + goto err_core_workq; for (i = 0; i < MTK_VDEC_HW_MAX; i++) mutex_init(&dev->dec_mutex[i]);