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: 34292 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0ok0-0002Ae-KQ; Thu, 12 May 2016 11:25:16 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-5) with esmtp id 1b0ojy-0002t5-80; Thu, 12 May 2016 13:25:16 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751364AbcELLYt (ORCPT + 1 other); Thu, 12 May 2016 07:24:49 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:29206 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751425AbcELLYl (ORCPT ); Thu, 12 May 2016 07:24:41 -0400 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 CC: Eddie Huang , Yingjoe Chen , , , , , , , , Andrew-CT Chen , Tiffany Lin 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 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.5.12.111815 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODY_SIZE_4000_4999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_URI_HTTPS 0, REFERENCES 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __DATE_TZ_HK 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __MULTIPLE_RCPTS_TO_X5 0, __REFERENCES 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0' 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 *