Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3484497pxt; Tue, 10 Aug 2021 04:56:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdgIQuKas8J6OFBZebybXSKu+i0MGcZpGF2xAgQyNwrXRB3pHVajJs0d0SGwx9RjYeyNj7 X-Received: by 2002:a5d:8245:: with SMTP id n5mr70654ioo.145.1628596598950; Tue, 10 Aug 2021 04:56:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628596598; cv=none; d=google.com; s=arc-20160816; b=tq6zFbLFX9NEUmmOmChYcaLODoK2hTo+KB+6lzgPkb7ZGiHW7UtBvxjai5yEP5/PKI dmTo5s0DbLupudPhc5htVanYCB7n4o5owNarGpNR/hygV/a/P2v6q6fiIoJ6taoQXPrz PZ+h8o+XOFSTIc6qKLOfjmNYCgiBBj0YF+AflPA74JHs5otwAM2yQnfPIydxKGirmoZQ GEWcvA9TKOIq/G93C/Lwd9FKPHCxSE+JbfJnGYEvIKpFiOdA8nM0H8v/AnEWISi8DXNF g55G2TFbngHuOu6jfXyXC7ZjPQFCklFjBbUxPyz6gebbWnaQNW7EJGAV/c/mqwnKxR9+ Mhfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=P0fIbkFK5BKaJp7STv9E+CYOPJWjv2UBfAwd+eD6K3A=; b=RTF28rk2FJ0dFCMT2ACzJzlqlqa7qP6ewdQThOu4NN69zG38ZF6Sye5SEvI9gMdTvX pui775lFTxL3blvdp6Gu7hHWEFHBmsLQyKVjZtCjmGGjWcKKGS8Qv3KecXX/lpMLMm1S 31sdqpBFO9rNQODbd2BbH3QsxtnpQ91342JvuHdrTli+SLBgZ9jbBHBLUGIDRc19yo/d rbPHuIiHBg9VMyMaEkRjivMqUAZ9bbpZqAIv+c86rvPtWnZslKQqkz4eFirTWGWI//uy rOpE6n0xw1//dKcKryHYX+VgF+wQOyovXu+MqgG6qU45ThRBM7NoZD9yaSovZM9lr5a7 oDMg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si21936218jar.33.2021.08.10.04.56.26; Tue, 10 Aug 2021 04:56:38 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238249AbhHJIbr (ORCPT + 99 others); Tue, 10 Aug 2021 04:31:47 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:57610 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S238240AbhHJIbq (ORCPT ); Tue, 10 Aug 2021 04:31:46 -0400 X-UUID: 02d2bf8778ca4c968c4a06cf98ca0160-20210810 X-UUID: 02d2bf8778ca4c968c4a06cf98ca0160-20210810 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 420778232; Tue, 10 Aug 2021 16:31:21 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 10 Aug 2021 16:31:20 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 10 Aug 2021 16:31:19 +0800 From: Yunfei Dong To: Yunfei Dong , Alexandre Courbot , Hans Verkuil , Tzung-Bi Shih , Tiffany Lin , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Tomasz Figa CC: Hsin-Yi Wang , Fritz Koenig , Irui Wang , , , , , , , , George Sun Subject: [PATCH v4, 00/15] Using component framework to support multi hardware decode Date: Tue, 10 Aug 2021 16:30:32 +0800 Message-ID: <20210810083047.16693-1-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds support for multi hardware decode into mtk-vcodec, by first adding component framework to manage each hardware information: interrupt, clock, register bases and power. Secondly add core thread to deal with core hardware message, at the same time, add msg queue for different hardware share messages. Lastly, the architecture of different specs are not the same, using specs type to separate them. This series has been tested with both MT8183 and MT8173. Decoding was working for both chips. Patches 1~3 rewrite get register bases and power on/off interface. Patch 4 add component framework to support multi hardware. Patch 5 separate video encoder and decoder document Patches 6-15 add interfaces to support core hardware. ---- This patch dependents on "media: mtk-vcodec: support for MT8183 decoder"[1]. Multi hardware decode is based on stateless decoder, MT8183 is the first time to add stateless decoder. Otherwise it will cause conflict. Please also accept this patch together with [1]. [1]https://lore.kernel.org/patchwork/project/lkml/list/?series=507084 ---- Changes compared with v3: - Fix return value for patch 1/15 - Fix comments for patch 4/15 > Looking up "mediatek,mtk-vcodec-core" to determine if it uses component framwork sounds like... Add prameter in pdata, for all platform will use compoent after mt8183 >> + if (dev->is_comp_supported) { >> + ret = mtk_vcodec_init_master(dev); >> + if (ret < 0) >> + goto err_component_match; >> + } else { >> + platform_set_drvdata(pdev, dev); >> + } > + Has asked the same question in [1]. Why it removes the > +platform_set_drvdata() above? mtk_vcodec_init_master() also calls platform_set_drvdata(). Must call component_master_add_with_match after platform_set_drvdata for component architecture. - Fix yaml files check fail for patch 5/15 - Fix yaml file check fail for patch 14/15 Changes compared with v1: - Fix many comments for patch 3/14 - Remove unnecessary code for patch 4/14 - Using enum mtk_vdec_hw_count instead of magic numbers for patch 6/14 - Reconstructed get/put lat buffer for lat and core hardware for patch 7/14 - Using yaml format to instead of txt file for patch 12/14 Yunfei Dong (15): media: mtk-vcodec: Get numbers of register bases from DT media: mtk-vcodec: Align vcodec wake up interrupt interface media: mtk-vcodec: Refactor vcodec pm interface media: mtk-vcodec: Use component framework to manage each hardware information dt-bindings: media: mtk-vcodec: Separate video encoder and decoder dt-bindings media: mtk-vcodec: Use pure single core for MT8183 media: mtk-vcodec: Add irq interface for multi hardware media: mtk-vcodec: Add msg queue feature for lat and core architecture media: mtk-vcodec: Generalize power and clock on/off interfaces media: mtk-vcodec: Add new interface to lock different hardware media: mtk-vcodec: Add core thread media: mtk-vcodec: Support 34bits dma address for vdec dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for mt8192 media: mtk-vcodec: Add core dec and dec end ipi msg media: mtk-vcodec: Use codec type to separate different hardware .../media/mediatek,vcodec-comp-decoder.yaml | 172 +++++++++++ .../media/mediatek,vcodec-decoder.yaml | 175 +++++++++++ .../media/mediatek,vcodec-encoder.yaml | 185 +++++++++++ .../bindings/media/mediatek-vcodec.txt | 130 -------- drivers/media/platform/mtk-vcodec/Makefile | 2 + .../platform/mtk-vcodec/mtk_vcodec_dec.c | 4 +- .../platform/mtk-vcodec/mtk_vcodec_dec.h | 1 + .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 280 ++++++++++++++--- .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c | 184 +++++++++++ .../platform/mtk-vcodec/mtk_vcodec_dec_hw.h | 53 ++++ .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 98 ++++-- .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h | 13 +- .../mtk-vcodec/mtk_vcodec_dec_stateful.c | 2 + .../mtk-vcodec/mtk_vcodec_dec_stateless.c | 2 + .../platform/mtk-vcodec/mtk_vcodec_drv.h | 71 ++++- .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 12 +- .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 1 - .../platform/mtk-vcodec/mtk_vcodec_intr.c | 27 +- .../platform/mtk-vcodec/mtk_vcodec_intr.h | 4 +- .../platform/mtk-vcodec/mtk_vcodec_util.c | 87 +++++- .../platform/mtk-vcodec/mtk_vcodec_util.h | 8 +- .../platform/mtk-vcodec/vdec/vdec_h264_if.c | 2 +- .../mtk-vcodec/vdec/vdec_h264_req_if.c | 2 +- .../platform/mtk-vcodec/vdec/vdec_vp8_if.c | 2 +- .../platform/mtk-vcodec/vdec/vdec_vp9_if.c | 2 +- .../media/platform/mtk-vcodec/vdec_drv_if.c | 21 +- .../media/platform/mtk-vcodec/vdec_ipi_msg.h | 16 +- .../platform/mtk-vcodec/vdec_msg_queue.c | 290 ++++++++++++++++++ .../platform/mtk-vcodec/vdec_msg_queue.h | 157 ++++++++++ .../media/platform/mtk-vcodec/vdec_vpu_if.c | 46 ++- .../media/platform/mtk-vcodec/vdec_vpu_if.h | 22 ++ .../platform/mtk-vcodec/venc/venc_h264_if.c | 2 +- .../platform/mtk-vcodec/venc/venc_vp8_if.c | 2 +- 33 files changed, 1795 insertions(+), 280 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/mediatek,vcodec-comp-decoder.yaml create mode 100644 Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml create mode 100644 Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml delete mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec.txt create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.h create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.c create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.h -- 2.25.1