Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3104327pxb; Sun, 29 Aug 2021 13:51:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxT97t0CkTbCrhHsUCSN0gGqYWODLQSsb56KMZg65izpmCxw0W6+08xIhLajM7TBUWGLJ+P X-Received: by 2002:a92:c241:: with SMTP id k1mr14180450ilo.270.1630270295718; Sun, 29 Aug 2021 13:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630270295; cv=none; d=google.com; s=arc-20160816; b=H/XwipG7hy1sN3lPi6LD8P4i/8DOLE4hZ6Cuee9o/xuThU6qkIHMTdrwYhGRE3RdmY Qexwe5TfgCP8aclsqsDI5f86uDwT1HOBkTyxbl+nPtwmfR2zCLBi9T5oe9COP9og9WB2 9P+JrXe3nk3dAsUfhuw99RrlyU3aRr9IiqZDXw3bs9oaG7FvhD5S+XABIaU9aqCkPqy5 X8b3Evt3bQMNTLCDCWmL8x65PrClXV4fFES9s3W3zKEuXBQP3LhA1Uw8YhZ70K3UVc19 02Qu5EIbgbnZBvXPO9jgr2/LdrK43E7Fh70GjsKVPzTpvJm6aWE2d5UtWvPV+gK2K8J5 N9yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=bdNYVnY8wew5VKV8LOdUkcIS13QxalxT7B4uy/fmPwU=; b=mfLlScXlgH4cL2Fsi7QS0mbW5s+T/HTjxGpUkCaDMft3B4cvwJ/DyrWv7NLepPW/bK 4YEceYsklkA+/yFdblUJwuAcLOnfhKtxhr8N4guIEDHqnoQeeWE8xxMDyDnhixrg+nVv FdKI5pKciHXt18f+c0JPYP/1cjsdGKPaZsJEIMf3vuvNkifRIsPKF5INwu7c7YpytwCm EAu8vzFGCYoD3jmdzIe2MzX43AyD3rK6ot3CyZmFwL/mhPqj69yfYehFj39FUPNMpjPh +F7ol3MINy6L7qtzvyuYH9RC6U/f5lxG7T6H+h8Mtkwg716m3UygsV0+2EXIi0hiDJn9 2f3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vanguardiasur-com-ar.20150623.gappssmtp.com header.s=20150623 header.b=XZidhiGG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q9si66307ile.120.2021.08.29.13.51.24; Sun, 29 Aug 2021 13:51:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@vanguardiasur-com-ar.20150623.gappssmtp.com header.s=20150623 header.b=XZidhiGG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235222AbhH2Uvi (ORCPT + 99 others); Sun, 29 Aug 2021 16:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234955AbhH2Uvh (ORCPT ); Sun, 29 Aug 2021 16:51:37 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 335C2C0613D9 for ; Sun, 29 Aug 2021 13:50:45 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id j13so13209835edv.13 for ; Sun, 29 Aug 2021 13:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vanguardiasur-com-ar.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bdNYVnY8wew5VKV8LOdUkcIS13QxalxT7B4uy/fmPwU=; b=XZidhiGGeZHDe0k1/vjoba3xx0Zek1MPYwws0fBuZuQfZCHvE9gFzJahUipyyF9pEx az0Y4VAokmxqq1+HBUWytSLzqZNgDtxlvMKMLAMgKFo4Ne3GFtslK7IsJcNXqK7WINyg R01vqgdhHItsymuoUX4yGGgKLsuUI/ws9KV09shFCyhyRTLV9QXESf00woZGJWkkXw7l 5RnLxcP+yCJ9AI6r9QiHDhJuQcAKNgr1WgSS8e/0IsQeKnK48toJvUo3L/vsgET0xWFR 6D8XI+UBxApXehLnd+jtJGfmsJlr2NAzLwz8q0/0CyBvxqPPioDiSpzXd1u+NsslpR3O qLeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bdNYVnY8wew5VKV8LOdUkcIS13QxalxT7B4uy/fmPwU=; b=QvbvJFcdN5nv02nrxWoU3RYm4eUxTP9eek74/8xB8OEeFnL2c0E+n6BfCnZfn01RNS eSwIsTwndbCJnmvCy+hMqe6kascpei8Pmg8zg/PnCdoomOw/IQh15Ub/EnXAn9Ym3Dam fsMJ05e5DC3S4g1AIJ8y3mOUT8l7fPGRkDSmjPH9YXywXxYR670/5RX0f7JDrsaOUIGT FpX2bWfP6aPwGCwrHbGRGBC66BS9+CSnVb2ihynSPqQP6lPfiLAPk5YGowQuQM7d6XVo yIT1mB3UZCd/vrbWaVvhH8tXB/UcFX3Wb8C+42dABZiew2+ZkQIW31o5BMdaiym2VJo8 gk3A== X-Gm-Message-State: AOAM5306ujGgUcVGJtmIpsapmnIB+9APh9AdqboF4hftKHLYeiFVswtD SzuhcI6BO5tlIhet2er/JQWOlvJ8yTrqazJC4fwytQ== X-Received: by 2002:aa7:db8b:: with SMTP id u11mr20368778edt.362.1630270243611; Sun, 29 Aug 2021 13:50:43 -0700 (PDT) MIME-Version: 1.0 References: <20210811025801.21597-1-yunfei.dong@mediatek.com> <20210811025801.21597-14-yunfei.dong@mediatek.com> In-Reply-To: From: Ezequiel Garcia Date: Sun, 29 Aug 2021 17:50:31 -0300 Message-ID: Subject: Re: [PATCH v5, 13/15] dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for mt8192 To: Laurent Pinchart Cc: Yunfei Dong , Alexandre Courbot , Hans Verkuil , Tzung-Bi Shih , Tiffany Lin , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Tomasz Figa , Hsin-Yi Wang , Fritz Koenig , Irui Wang , linux-media , devicetree , Linux Kernel Mailing List , linux-arm-kernel , srv_heupstream , "moderated list:ARM/Mediatek SoC support" , Project_Global_Chrome_Upstream_Group , George Sun Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Aug 2021 at 14:59, Laurent Pinchart wrote: > > Hi Yunfei, > > Thank you for the patch. > > On Wed, Aug 11, 2021 at 10:57:59AM +0800, Yunfei Dong wrote: > > Adds decoder dt-bindings for mt8192. > > > > Signed-off-by: Yunfei Dong > > --- > > v5: no changes > > > > This patch depends on "Mediatek MT8192 clock support"[1]. > > > > The definition of decoder clocks are in mt8192-clk.h, need to include them in case of build fail [1]. > > > > [1]https://patchwork.kernel.org/project/linux-mediatek/list/?series=511175 > > --- > > .../media/mediatek,vcodec-comp-decoder.yaml | 172 ++++++++++++++++++ > > 1 file changed, 172 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/media/mediatek,vcodec-comp-decoder.yaml > > > > diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-comp-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-comp-decoder.yaml > > new file mode 100644 > > index 000000000000..083c89933917 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-comp-decoder.yaml > > @@ -0,0 +1,172 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/iommu/mediatek,vcodec-comp-decoder.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Mediatek Video Decode Accelerator With Component > > + > > +maintainers: > > + - Yunfei Dong > > + > > +description: |+ > > + Mediatek Video Decode is the video decode hardware present in Mediatek > > + SoCs which supports high resolution decoding functionalities. Required > > + master and component node. > > This should explain how the three IP cores relate to each other. > > > + > > +properties: > > + compatible: > > + oneOf: > > + - enum: > > + - mediatek,mt8192-vcodec-dec # for lat hardware > > + - mediatek,mtk-vcodec-lat # for core hardware > > + - mediatek,mtk-vcodec-core > > + > > + reg: > > + maxItems: 1 > > + > > + interrupts: > > + maxItems: 1 > > + > > + clocks: > > + maxItems: 5 > > + > > + clock-names: > > + items: > > + - const: vdec-sel > > + - const: vdec-soc-vdec > > + - const: vdec-soc-lat > > + - const: vdec-vdec > > + - const: vdec-top > > + > > + assigned-clocks: true > > + > > + assigned-clock-parents: true > > + > > + power-domains: > > + maxItems: 1 > > + > > + iommus: > > + minItems: 1 > > + maxItems: 32 > > + description: | > > + List of the hardware port in respective IOMMU block for current Socs. > > + Refer to bindings/iommu/mediatek,iommu.yaml. > > + > > + dma-ranges: > > + maxItems: 1 > > + description: | > > + Describes the physical address space of IOMMU maps to memory. > > + > > + mediatek,scp: > > + $ref: /schemas/types.yaml#/definitions/phandle > > + maxItems: 1 > > + description: > > + Describes point to scp. > > + > > +required: > > + - compatible > > + - reg > > + - iommus > > + - dma-ranges > > + > > +allOf: > > + - if: #master node > > + properties: > > + compatible: > > + contains: > > + enum: > > + - mediatek,mt8192-vcodec-dec # for lat hardware > > + > > + then: > > + required: > > + - mediatek,scp > > + > > + - if: #component node > > + properties: > > + compatible: > > + contains: > > + enum: > > + - mediatek,mtk-vcodec-lat # for core hardware > > + - mediatek,mtk-vcodec-core > > + > > + then: > > + required: > > + - interrupts > > + - clocks > > + - clock-names > > + - assigned-clocks > > + - assigned-clock-parents > > + - power-domains > > + > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + #include > > + #include > > + #include > > + #include > > + #include > > + > > + vcodec_dec: vcodec_dec@16000000 { > > + compatible = "mediatek,mt8192-vcodec-dec"; > > + reg = <0 0x16000000 0 0x1000>; /* VDEC_SYS */ > > + mediatek,scp = <&scp>; > > + iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>; > > + dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; > > + }; > > + > > + vcodec_lat: vcodec_lat@0x16010000 { > > + compatible = "mediatek,mtk-vcodec-lat"; > > + reg = <0 0x16010000 0 0x800>; /* VDEC_MISC */ > > + interrupts = ; > > + iommus = <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD_EXT>, > > + <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD2_EXT>, > > + <&iommu0 M4U_PORT_L5_VDEC_LAT0_AVC_MV_EXT>, > > + <&iommu0 M4U_PORT_L5_VDEC_LAT0_PRED_RD_EXT>, > > + <&iommu0 M4U_PORT_L5_VDEC_LAT0_TILE_EXT>, > > + <&iommu0 M4U_PORT_L5_VDEC_LAT0_WDMA_EXT>, > > + <&iommu0 M4U_PORT_L5_VDEC_LAT0_RG_CTRL_DMA_EXT>, > > + <&iommu0 M4U_PORT_L5_VDEC_UFO_ENC_EXT>; > > + dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; > > + clocks = <&topckgen CLK_TOP_VDEC_SEL>, > > + <&vdecsys_soc CLK_VDEC_SOC_VDEC>, > > + <&vdecsys_soc CLK_VDEC_SOC_LAT>, > > + <&vdecsys_soc CLK_VDEC_SOC_LARB1>, > > + <&topckgen CLK_TOP_MAINPLL_D4>; > > + clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-soc-lat", > > + "vdec-vdec", "vdec-top"; > > + assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>; > > + assigned-clock-parents = <&topckgen CLK_TOP_MAINPLL_D4>; > > + power-domains = <&spm MT8192_POWER_DOMAIN_VDEC>; > > + }; > > + > > + vcodec_core: vcodec_core@0x16025000 { > > + compatible = "mediatek,mtk-vcodec-core"; > > + reg = <0 0x16025000 0 0x1000>; /* VDEC_CORE_MISC */ > > + interrupts = ; > > + iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>, > > + <&iommu0 M4U_PORT_L4_VDEC_UFO_EXT>, > > + <&iommu0 M4U_PORT_L4_VDEC_PP_EXT>, > > + <&iommu0 M4U_PORT_L4_VDEC_PRED_RD_EXT>, > > + <&iommu0 M4U_PORT_L4_VDEC_PRED_WR_EXT>, > > + <&iommu0 M4U_PORT_L4_VDEC_PPWRAP_EXT>, > > + <&iommu0 M4U_PORT_L4_VDEC_TILE_EXT>, > > + <&iommu0 M4U_PORT_L4_VDEC_VLD_EXT>, > > + <&iommu0 M4U_PORT_L4_VDEC_VLD2_EXT>, > > + <&iommu0 M4U_PORT_L4_VDEC_AVC_MV_EXT>, > > + <&iommu0 M4U_PORT_L4_VDEC_RG_CTRL_DMA_EXT>; > > + dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>; > > + clocks = <&topckgen CLK_TOP_VDEC_SEL>, > > + <&vdecsys CLK_VDEC_VDEC>, > > + <&vdecsys CLK_VDEC_LAT>, > > + <&vdecsys CLK_VDEC_LARB1>, > > + <&topckgen CLK_TOP_MAINPLL_D4>; > > + clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-soc-lat", > > + "vdec-vdec", "vdec-top"; > > + assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>; > > + assigned-clock-parents = <&topckgen CLK_TOP_MAINPLL_D4>; > > + power-domains = <&spm MT8192_POWER_DOMAIN_VDEC2>; > > + }; > > I'm a bit late in the game, reviewing v5 only, but I'm wondering if > those IP cores need to be modelled in separate nodes. It would be much > easier, from a software point of view, to have a single node, with > multiple register ranges. > > Are some of those IP cores used in different SoCs, combined in different > ways, that make a modular design better ? > Yeah, I agree with Laurent here. This way of modelling the different parts of the CODEC as different pieces is the reason why you need a framework to pull them together, such as the component API (I guess v4l2-async could have been used as well). I normally don't bother with driver internals, as its up to each driver author to decide what is best. However, I believe this design is too convoluted, and it may lead other developers to follow the same pattern, so please avoid it. There are several ways of modelling this and initializing or probing the sub-devices, without using any async framework. Thanks, Ezequiel