Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7278905rwl; Thu, 23 Mar 2023 01:53:47 -0700 (PDT) X-Google-Smtp-Source: AK7set8fOLaH8TVVRPCYsVxIDoHRrLhVMATNEgSMpcacNo+XA2l/bK0/GD5/5d9FgUrnLQRcs2Uk X-Received: by 2002:aa7:d859:0:b0:4ab:d1f4:4b88 with SMTP id f25-20020aa7d859000000b004abd1f44b88mr8082205eds.41.1679561626763; Thu, 23 Mar 2023 01:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679561626; cv=none; d=google.com; s=arc-20160816; b=higtly1piBhBDO9Wf6Z3/zowc7owk9y+SWzbt+XBy8dJ75q/NQTgnndD7U/UoT7Vta qPsih94NSyHW4wqyxoTRrBnW0VTVH4hMA0HY9Ux6aw8A7T3UlKk36xsVMoFvC1NzIaBT X+sBLfja3H9TCiaF4rpX032BxaQGoEzhL38NwZFtV7LCZMCeCkrywcOObrN2CCMcvcfx cXjoSo/aKp1KW2TpVFvKki0g/N1q4ZLdM/nqesjKe2nWLkPZqwz/V4OUf7jAq+I57mWZ 4qrbf50UMKP7TYORe/l3PxZlxG/YGSVZxrj52rvHgOuZCu+BPV6Q57unH8nVJmJZeM1c BJtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=02p1XoxXrLuMUBe0CjfZAi7psUBwCDsTusscQOeN2kU=; b=vldhcxb0dqCfhdjRBGFKQChC6QXTre4lij4WTBs3NgXnBMHF34N2qt0WbDvqPQBbpw YTVbc5S39imd11PQQ/uBfCE4bK/1fyEsKBGT9f37gN1116fBDxIfJ5NEPvzB7D7TWRAx 3/QB3i+VIwUzvGb25ondhJTDVIEbgV4Zzm3XKepltzMiOZQ7PIcU+HkDnhBNbxPLXt4W 08lLX6IDYY1mL1SYX/StQZI5jadoiPBcd+vlsrPHPxST1PdDflLL/PyWr5Mfy1aiF8OT +yge2+LUB0CNPD3CPhwN1VpIH1lTgOYoCFgFX3cCwLiqNj/3T+uQORc27POX47aEj5Tm 9ogQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=f7OnHpUT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020aa7c90f000000b00501d50c1416si7872744edt.411.2023.03.23.01.52.58; Thu, 23 Mar 2023 01:53:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=f7OnHpUT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231465AbjCWIkE (ORCPT + 99 others); Thu, 23 Mar 2023 04:40:04 -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=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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]); -- 2.18.0