From patchwork Fri Sep 24 09:27:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?S3lyaWUgV3UgKOWQtOaZlyk=?= X-Patchwork-Id: 12514631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74C3DC433EF for ; Fri, 24 Sep 2021 09:29:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3FDFB60EFD for ; Fri, 24 Sep 2021 09:29:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3FDFB60EFD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=QfSZUs1jwLmN7zdq32JtEwRbkgdaDADBaZludTFDe0c=; b=vv7UU1mfea6thF HJb6TaKOzjZ+Oik3CeCKT0zNkRDDfNddvxx6+8S2Haa/t/UHJ4Lm+9XBy7dTlEt2VMoeksfAV5dPb F/0diBMUq7f1SZV8SVqHQECRl0x1vfWUJ14ZXkkQu0HnkFwfbZmRKOoRZcNHh1ZqjiviXx7URNrTd oxdOZZGcGm+Z1iNFwftLZDhuNO2X+kxGdiYQdFNQEv/W7wHRR/EHXvUZ9PAtGZgjI8Mo3mSpmQP6I 6pS4YAIOLfeHeqwIPiHY3PWf1s6ipukiivLWb8YEOUGB5pr24k4eIHOY9YqYwnI4QVNCoye7iZVNM hzKCY08Ql/bwaS2RzYdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mThUF-00DqZj-Fz; Fri, 24 Sep 2021 09:27:19 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mThUC-00DqZB-2o; Fri, 24 Sep 2021 09:27:17 +0000 X-UUID: edada33d1a8a4030b9778a909b476f18-20210924 X-UUID: edada33d1a8a4030b9778a909b476f18-20210924 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 801193823; Fri, 24 Sep 2021 02:27:12 -0700 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 24 Sep 2021 02:27:10 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 24 Sep 2021 17:27:08 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 24 Sep 2021 17:27:07 +0800 From: kyrie.wu To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Tomasz Figa , Matthias Brugger , "Tzung-Bi Shih" CC: , , , , , , , , , , Subject: [PATCH RESEND,V4,0/5] Support jpeg encoder for MT8195 Date: Fri, 24 Sep 2021 17:27:03 +0800 Message-ID: <1632475628-29271-1-git-send-email-kyrie.wu@mediatek.com> X-Mailer: git-send-email 2.6.4 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210924_022716_137375_A2BE8C90 X-CRM114-Status: GOOD ( 14.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Main changes compared to v4: --Add cover latter base on v3 Main changes compared to v3: --Structure patches for consistency, non-backward compatible and do not break any existing functionality Main changes compared to v2: --Split the last two patches into several patches to enhance readability --Correct some syntax errors --Explain why the component framework is used Main changes compared to v1: --Add jpeg encoder dt-bindings for MT8195 --Use component framework to manage jpegenc HW --Add jpegenc output pic reorder function interface MT8195 has two jpeg encoding HW, each one has its own power-domain, clock, interrupt, register base. The two jpeg encoding HW can work together to achieve higher performance. Generally, one HW needs to register one device node, and the APP operates the HW through the device node. If there are multiple HWs, the multiple device node needs to be registered. At this time, the app needs to design software logic to use multiple HWs in parallel, which will undoubtedly increase the difficulty of app development and weaken its compatibility. These serial patches use the component framework to achieve the purpose of using multiple HWs through only one device node. About the component framework Block Diagram, please check below: Master(device node) ________|_________________________ | | | component0(HW0) component1(HW1) component2(HW2) ...... As above, the component framework is similar to a master-component two level architecture. Both master and component have the compatible attribute in the device tree, and the corresponding platform driver structure is defined in the driver. Therefore, when the compatible attribute matches, the corresponding probe function will be called. In the probe function of component, operations such as initialization clock, remmap register base, registration interrupt will be performed. And add the component to a component linked list to find the corresponding master. In the probe function of the master, the device node will be registered, and the master will be added to a master linked list to find the corresponding component. After the master matches the component, it will obtain the clock, interrupt, register base and other resources in the component, and operate the HW through these resources. At the same time, multiple HWs software function interfaces are designed in the master driver. kyrie.wu (5): dt-bindings: mediatek: Add mediatek, mt8195-jpgenc compatible media: mtk-jpegenc: Use component framework to manage each hardware media: mtk-jpegenc: add jpegenc timeout func interface media: mtk-jpegenc: add jpeg encode worker interface media: mtk-jpegenc: add output pic reorder interface .../bindings/media/mediatek-jpeg-encoder.yaml | 3 + drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 395 ++++++++++++++++++--- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h | 79 +++++ drivers/media/platform/mtk-jpeg/mtk_jpeg_enc_hw.c | 298 ++++++++++++++++ 4 files changed, 730 insertions(+), 45 deletions(-) --- 2.6.4