From patchwork Thu Mar 23 08:38:10 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: 73905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2794287wrt; Thu, 23 Mar 2023 01:53:49 -0700 (PDT) X-Google-Smtp-Source: AK7set+qoPw3CJpGwKSg2+EjzxBukH4cRnOI8KdjsAFG6jszyvAnip0xDf4Rs7an66mDersxTvJg X-Received: by 2002:aa7:dbcf:0:b0:501:c672:5812 with SMTP id v15-20020aa7dbcf000000b00501c6725812mr9752302edt.33.1679561628817; Thu, 23 Mar 2023 01:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679561628; cv=none; d=google.com; s=arc-20160816; b=We2sS4vnowCrvVusTJqD4KWfkBwI2164hNm4fTgYlIDypoVSxhZCg7c1VyET90jZnA 6Xpr/72VabQzrOSnhVPjhnSn6LGFr39yFJUoW9x3RCGWu0VEOcWrhtpfeKKIaBZ5j4gA MW2ZJf8nq9GZFsZlkneQrrYNx9j39Csjzz7gRoc8ypLFTMdp5txhCrHDhinb2juSMq2Z sEcyF1KfSt0XkuYT0BEat8NFYFbT3Flr1JBq4BzlOWHBWzxp+HzGdDTDQBxsz3/bYlmt OpO7UQO9ulGv7wK+nJflLhJv6pNSwKGiitGr0Fr958VXGLBMSnjLb+M2AUfh+brKDM3q OXVg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NJcNAlsmBP8ajxbJLlshcvTja5PdCGJYpyuZW/mV0zg=; b=XZaa/CJ8nSqGTw8ZTKY4UwdwXQ4SeTwTh7LSaniiBJcEN0wG+FQuQMF8TB/X27T5hU a0vajrUqR+MchkMFaiGvT5Om1s/xP+5yPJDeN2u4ty3+NurHjEkoANTELka8A1rN79Hc 8PVWPqXSXj/0J2UnTj3IwdHavvAqcAxBBBTtBz461WamnlBLvLC2udedviaJLvBlsB2A ODpwaxI6tbQJUBwveix7XH3ih9cpxa343wY9pp1aZdEv4dp/KkGX3VkZYIHuODmNIAjA xJHmyhmAt38A2My8rie2M89LTMq8IJXKIsJexX2o4/9rTl5QpGCELxzcz24yJCGwVtVm DWww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=SFsSgoDO; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d16-20020a056402517000b004fd2b0b6f16si9664965ede.355.2023.03.23.01.53.24; Thu, 23 Mar 2023 01:53:48 -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=SFsSgoDO; 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 S231153AbjCWIkJ (ORCPT + 99 others); Thu, 23 Mar 2023 04:40:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231557AbjCWIjo (ORCPT ); Thu, 23 Mar 2023 04:39:44 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0097012BE6; Thu, 23 Mar 2023 01:38:23 -0700 (PDT) X-UUID: 0d57358ec95611edb6b9f13eb10bd0fe-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:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=NJcNAlsmBP8ajxbJLlshcvTja5PdCGJYpyuZW/mV0zg=; b=SFsSgoDOzpwhzNvn2YlczMXgWjd/W/QSiONnTZJUG7dTlNh5ixf5jOkLomnTvX39X+JYSWBNLn7HAliQlv8MchVA+kw6fZ4nrbYia2Oh/8LWT8Pjyv++XjSgRv4fDWwuSwMLPAgw3JK5RWWiU35F1mgEJTUncaHYLB0IXyA4dmE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:2e8a60e1-c5d1-494e-9c62-0b8a381178d8,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.22,REQID:2e8a60e1-c5d1-494e-9c62-0b8a381178d8,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:120426c,CLOUDID:0974aff6-ddba-41c3-91d9-10eeade8eac7,B ulkID:230323163816TTGHMBG2,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL: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: 0d57358ec95611edb6b9f13eb10bd0fe-20230323 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1136355085; Thu, 23 Mar 2023 16:38:14 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n1.mediatek.inc (172.21.101.193) 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:13 +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:12 +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 2/2] media: mediatek: vcodec: Remove encoder 'dma-ranges' conditon when set dma mask Date: Thu, 23 Mar 2023 16:38:10 +0800 Message-ID: <20230323083810.21912-2-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323083810.21912-1-yunfei.dong@mediatek.com> References: <20230323083810.21912-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,RDNS_NONE,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761148014734937609?= X-GMAIL-MSGID: =?utf-8?q?1761148014734937609?= 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 --- 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) {