From patchwork Thu May 12 11:24:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "tiffany.lin" X-Patchwork-Id: 9079381 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0908D9F1C3 for ; Thu, 12 May 2016 11:27:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A97E02021B for ; Thu, 12 May 2016 11:27:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B24D020218 for ; Thu, 12 May 2016 11:27:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0okY-0001HP-Hm; Thu, 12 May 2016 11:25:50 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0ojg-0007zT-FH; Thu, 12 May 2016 11:25:03 +0000 Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 442058251; Thu, 12 May 2016 19:24:18 +0800 Received: from localhost.localdomain (10.21.14.115) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Thu, 12 May 2016 19:24:15 +0800 From: Tiffany Lin To: Hans Verkuil , , Rob Herring , Mauro Carvalho Chehab , Matthias Brugger , Daniel Kurtz , Pawel Osciak Subject: [PATCH v2 1/9] [media] VPU: mediatek: Add decode support Date: Thu, 12 May 2016 19:24:02 +0800 Message-ID: <1463052250-38262-2-git-send-email-tiffany.lin@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1463052250-38262-1-git-send-email-tiffany.lin@mediatek.com> References: <1463052250-38262-1-git-send-email-tiffany.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160512_042501_971891_37096D65 X-CRM114-Status: GOOD ( 14.38 ) X-Spam-Score: -1.1 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Tiffany Lin , Andrew-CT Chen , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, PoChun.Lin@mediatek.com, Yingjoe Chen , Eddie Huang , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andrew-CT Chen VPU driver add decode support Signed-off-by: Andrew-CT Chen Signed-off-by: Tiffany Lin --- drivers/media/platform/mtk-vpu/mtk_vpu.c | 12 ++++++++++++ drivers/media/platform/mtk-vpu/mtk_vpu.h | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c index b60d02c..ca23b1f 100644 --- a/drivers/media/platform/mtk-vpu/mtk_vpu.c +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c @@ -134,6 +134,8 @@ struct vpu_wdt { * * @signaled: the signal of vpu initialization completed * @fw_ver: VPU firmware version + * @dec_capability: decoder capability which is not used for now and + * the value is reserved for future use * @enc_capability: encoder capability which is not used for now and * the value is reserved for future use * @wq: wait queue for VPU initialization status @@ -141,6 +143,7 @@ struct vpu_wdt { struct vpu_run { u32 signaled; char fw_ver[VPU_FW_VER_LEN]; + unsigned int dec_capability; unsigned int enc_capability; wait_queue_head_t wq; }; @@ -415,6 +418,14 @@ int vpu_wdt_reg_handler(struct platform_device *pdev, } EXPORT_SYMBOL_GPL(vpu_wdt_reg_handler); +unsigned int vpu_get_vdec_hw_capa(struct platform_device *pdev) +{ + struct mtk_vpu *vpu = platform_get_drvdata(pdev); + + return vpu->run.dec_capability; +} +EXPORT_SYMBOL_GPL(vpu_get_vdec_hw_capa); + unsigned int vpu_get_venc_hw_capa(struct platform_device *pdev) { struct mtk_vpu *vpu = platform_get_drvdata(pdev); @@ -600,6 +611,7 @@ static void vpu_init_ipi_handler(void *data, unsigned int len, void *priv) vpu->run.signaled = run->signaled; strncpy(vpu->run.fw_ver, run->fw_ver, VPU_FW_VER_LEN); + vpu->run.dec_capability = run->dec_capability; vpu->run.enc_capability = run->enc_capability; wake_up_interruptible(&vpu->run.wq); } diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.h b/drivers/media/platform/mtk-vpu/mtk_vpu.h index 5ab37f0..f457479 100644 --- a/drivers/media/platform/mtk-vpu/mtk_vpu.h +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.h @@ -37,6 +37,18 @@ typedef void (*ipi_handler_t) (void *data, command to VPU. For other IPI below, AP should send the request to VPU to trigger the interrupt. + * @IPI_VDEC_H264: The interrupt from vpu is to notify kernel to + handle H264 vidoe decoder job, and vice versa. + Decode output format is always MT21 no matter what + the input format is. + * @IPI_VDEC_VP8: The interrupt from is to notify kernel to + handle VP8 video decoder job, and vice versa. + Decode output format is always MT21 no matter what + the input format is. + * @IPI_VDEC_VP9: The interrupt from vpu is to notify kernel to + handle VP9 video decoder job, and vice versa. + Decode output format is always MT21 no matter what + the input format is. * @IPI_VENC_H264: The interrupt from vpu is to notify kernel to handle H264 video encoder job, and vice versa. * @IPI_VENC_VP8: The interrupt fro vpu is to notify kernel to @@ -46,6 +58,9 @@ typedef void (*ipi_handler_t) (void *data, enum ipi_id { IPI_VPU_INIT = 0, + IPI_VDEC_H264, + IPI_VDEC_VP8, + IPI_VDEC_VP9, IPI_VENC_H264, IPI_VENC_VP8, IPI_MAX, @@ -55,10 +70,12 @@ enum ipi_id { * enum rst_id - reset id to register reset function for VPU watchdog timeout * * @VPU_RST_ENC: encoder reset id + * @VPU_RST_DEC: decoder reset id * @VPU_RST_MAX: maximum reset id */ enum rst_id { VPU_RST_ENC, + VPU_RST_DEC, VPU_RST_MAX, }; @@ -125,6 +142,16 @@ struct platform_device *vpu_get_plat_device(struct platform_device *pdev); int vpu_wdt_reg_handler(struct platform_device *pdev, void vpu_wdt_reset_func(void *), void *priv, enum rst_id id); + +/** + * vpu_get_vdec_hw_capa - get video decoder hardware capability + * + * @pdev: VPU platform device + * + * Return: video decoder hardware capability + **/ +unsigned int vpu_get_vdec_hw_capa(struct platform_device *pdev); + /** * vpu_get_venc_hw_capa - get video encoder hardware capability *