From patchwork Thu Jun 4 07:26:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209630 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, 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 EA0AEC433DF for ; Thu, 4 Jun 2020 07:31:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C69FE20663 for ; Thu, 4 Jun 2020 07:31:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="PhZG2KRu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728357AbgFDHbP (ORCPT ); Thu, 4 Jun 2020 03:31:15 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:36044 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727768AbgFDH3X (ORCPT ); Thu, 4 Jun 2020 03:29:23 -0400 X-UUID: 113561acb4354d378f5f95fac83ddf6d-20200604 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Gfwa+HEA1Fp8IFUeQUFuA37/N+o4Grdg0TxloGU3uxw=; b=PhZG2KRuoIqangRBxEDXB9lubZQEx9oWCB88yMzlpQYUffatlijEClT79/1ditbGF2lJEOanmv3jZwWHvvDs85bq92QOQCUyQGP41N30KxnroC7n5FiVp0Vr0a0s0JKcKoZVRQMHT8f1DmjIvL3Rt3gpdvTSexzZoeeFfPxhLyI=; X-UUID: 113561acb4354d378f5f95fac83ddf6d-20200604 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 211813436; Thu, 04 Jun 2020 15:29:18 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 15:29:15 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 4 Jun 2020 15:29:13 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Rick Chang CC: , , , , , Marek Szyprowski , Tomasz Figa , , , , , , , Xia Jiang Subject: [PATCH v9 02/18] media: platform: Improve queue set up flow for bug fixing Date: Thu, 4 Jun 2020 15:26:52 +0800 Message-ID: <20200604072708.9468-3-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604072708.9468-1-xia.jiang@mediatek.com> References: <20200604072708.9468-1-xia.jiang@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 Add checking created buffer size follow in mtk_jpeg_queue_setup(). Reviewed-by: Tomasz Figa Signed-off-by: Xia Jiang --- v9: no changes --- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.18.0 diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 4ad4a4b30a0e..67a022d04df7 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -571,6 +571,13 @@ static int mtk_jpeg_queue_setup(struct vb2_queue *q, if (!q_data) return -EINVAL; + if (*num_planes) { + for (i = 0; i < *num_planes; i++) + if (sizes[i] < q_data->sizeimage[i]) + return -EINVAL; + return 0; + } + *num_planes = q_data->fmt->colplanes; for (i = 0; i < q_data->fmt->colplanes; i++) { sizes[i] = q_data->sizeimage[i]; From patchwork Thu Jun 4 07:26:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209631 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 19679C433E1 for ; Thu, 4 Jun 2020 07:31:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E53EC20663 for ; Thu, 4 Jun 2020 07:31:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="urlwNGJM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728341AbgFDHbH (ORCPT ); Thu, 4 Jun 2020 03:31:07 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:36044 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728043AbgFDH30 (ORCPT ); Thu, 4 Jun 2020 03:29:26 -0400 X-UUID: 5327963303df4aa5804250a63c17ce6c-20200604 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=QieJajFUSDAATn0RLbYQatSFJzOR4F4C/wwtZYRLLOI=; b=urlwNGJMglfiOfVBtiNVNFvRQHANpd6QP7IEQ7h9SFbaZ6A6H9F0q0P7Z1zrtZ4uuLkY7w+P53Q4zCzA61+mCJAK7vjctUIDJ7FP0Yk/wVxKZEjb3iVa8mHXxKOAHxzG6cK87pjWAvelQthuzcYTWW3YQuY6EzwE3PTscMi+yp0=; X-UUID: 5327963303df4aa5804250a63c17ce6c-20200604 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 831859998; Thu, 04 Jun 2020 15:29:21 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 15:29:18 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 4 Jun 2020 15:29:16 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Rick Chang CC: , , , , , Marek Szyprowski , Tomasz Figa , , , , , , , Xia Jiang Subject: [PATCH v9 04/18] media: platform: Change the fixed device node number to unfixed value Date: Thu, 4 Jun 2020 15:26:54 +0800 Message-ID: <20200604072708.9468-5-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604072708.9468-1-xia.jiang@mediatek.com> References: <20200604072708.9468-1-xia.jiang@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 The driver can be instantiated multiple times, e.g. for a decoder and an encoder. Moreover, other drivers could coexist on the same system. This makes the static video node number assignment pointless, so switch to automatic assignment instead. Signed-off-by: Xia Jiang --- v9: change the commit message --- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.18.0 diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 2677580941b0..12609ca46fd9 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -1154,7 +1154,7 @@ static int mtk_jpeg_probe(struct platform_device *pdev) jpeg->dec_vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE; - ret = video_register_device(jpeg->dec_vdev, VFL_TYPE_VIDEO, 3); + ret = video_register_device(jpeg->dec_vdev, VFL_TYPE_VIDEO, -1); if (ret) { v4l2_err(&jpeg->v4l2_dev, "Failed to register video device\n"); goto err_dec_vdev_register; From patchwork Thu Jun 4 07:26:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209638 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham 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 0FD02C433DF for ; Thu, 4 Jun 2020 07:29:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD7F32074B for ; Thu, 4 Jun 2020 07:29:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="oRsfVQzi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728093AbgFDH3c (ORCPT ); Thu, 4 Jun 2020 03:29:32 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:28869 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728064AbgFDH3b (ORCPT ); Thu, 4 Jun 2020 03:29:31 -0400 X-UUID: cfc6fb16bf5c4c1c8011ba59839b9e94-20200604 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=B/w2ehlpdSMG2o1JAKklslgzvugqL0CKOQBnvbbutuc=; b=oRsfVQzimPN0y/qKqdnYUdnrOINeHCI9XGskqg74NqvXt5Uws7RaPXKBCR+ZwhjWZL8vI/XU0iSplf0jcQ4D2E/qDvdQTVGz+t4TlsCLcnEFlhyXboxX83a20LbpayIdzfhXNwo6Bfk0t470axRGMgGsveztQNNS+15iBjxQbms=; X-UUID: cfc6fb16bf5c4c1c8011ba59839b9e94-20200604 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 197240824; Thu, 04 Jun 2020 15:29:26 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 15:29:23 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 4 Jun 2020 15:29:21 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Rick Chang CC: , , , , , Marek Szyprowski , Tomasz Figa , , , , , , , Xia Jiang Subject: [PATCH v9 08/18] media: platform: Cancel the last frame handling flow Date: Thu, 4 Jun 2020 15:26:58 +0800 Message-ID: <20200604072708.9468-9-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604072708.9468-1-xia.jiang@mediatek.com> References: <20200604072708.9468-1-xia.jiang@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 There is no need to queue an empty buffer for signaling a last frame, because all frames are separate from each other in JPEG. Signed-off-by: Xia Jiang --- v9: new patch --- .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) -- 2.18.0 diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 49bdbf1c435f..bb4ebce881ee 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -55,15 +55,9 @@ static struct mtk_jpeg_fmt mtk_jpeg_formats[] = { #define MTK_JPEG_NUM_FORMATS ARRAY_SIZE(mtk_jpeg_formats) -enum { - MTK_JPEG_BUF_FLAGS_INIT = 0, - MTK_JPEG_BUF_FLAGS_LAST_FRAME = 1, -}; - struct mtk_jpeg_src_buf { struct vb2_v4l2_buffer b; struct list_head list; - int flags; struct mtk_jpeg_dec_param dec_param; }; @@ -520,8 +514,6 @@ static int mtk_jpeg_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) vb = vb2_get_buffer(vq, buf->index); jpeg_src_buf = mtk_jpeg_vb2_to_srcbuf(vb); - jpeg_src_buf->flags = (buf->m.planes[0].bytesused == 0) ? - MTK_JPEG_BUF_FLAGS_LAST_FRAME : MTK_JPEG_BUF_FLAGS_INIT; end: return v4l2_m2m_qbuf(file, fh->m2m_ctx, buf); } @@ -676,10 +668,6 @@ static void mtk_jpeg_buf_queue(struct vb2_buffer *vb) param = &jpeg_src_buf->dec_param; memset(param, 0, sizeof(*param)); - if (jpeg_src_buf->flags & MTK_JPEG_BUF_FLAGS_LAST_FRAME) { - v4l2_dbg(1, debug, &jpeg->v4l2_dev, "Got eos\n"); - goto end; - } header_valid = mtk_jpeg_parse(param, (u8 *)vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); if (!header_valid) { @@ -792,19 +780,12 @@ static void mtk_jpeg_device_run(void *priv) struct mtk_jpeg_src_buf *jpeg_src_buf; struct mtk_jpeg_bs bs; struct mtk_jpeg_fb fb; - int i, ret; + int ret; src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); jpeg_src_buf = mtk_jpeg_vb2_to_srcbuf(&src_buf->vb2_buf); - if (jpeg_src_buf->flags & MTK_JPEG_BUF_FLAGS_LAST_FRAME) { - for (i = 0; i < dst_buf->vb2_buf.num_planes; i++) - vb2_set_plane_payload(&dst_buf->vb2_buf, i, 0); - buf_state = VB2_BUF_STATE_DONE; - goto dec_end; - } - if (mtk_jpeg_check_resolution_change(ctx, &jpeg_src_buf->dec_param)) { mtk_jpeg_queue_src_chg_event(ctx); ctx->state = MTK_JPEG_SOURCE_CHANGE; From patchwork Thu Jun 4 07:26:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209633 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, 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 3811EC433E1 for ; Thu, 4 Jun 2020 07:30:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 146172075B for ; Thu, 4 Jun 2020 07:30:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="IId0EvSD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728321AbgFDHav (ORCPT ); Thu, 4 Jun 2020 03:30:51 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:28869 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728088AbgFDH3e (ORCPT ); Thu, 4 Jun 2020 03:29:34 -0400 X-UUID: 6cd257d7c5674d7696e431c5c2fc8ef7-20200604 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=pwxgK1X1XdIdmyvhCdOXj7GI0xWZ4kTcpeu8OdlT4i0=; b=IId0EvSD7jg837JzzGKXBe1embw/r6JMJTdklDLq5HLMRP1yUGNLhKRJQ5UdyNhs6/0TiBJKo465v0rAgpYsyIERh2w6LTGE5myALwmYb2w+JZwoJBGSWQoT/IZiiWmpr7sqbhpqyIbhcvTfLaIAble/UatIRtkCsyCguu/CNNU=; X-UUID: 6cd257d7c5674d7696e431c5c2fc8ef7-20200604 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 677953915; Thu, 04 Jun 2020 15:29:27 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 15:29:24 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 4 Jun 2020 15:29:23 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Rick Chang CC: , , , , , Marek Szyprowski , Tomasz Figa , , , , , , , Xia Jiang Subject: [PATCH v9 09/18] media: platform: Delete zeroing the reserved fields Date: Thu, 4 Jun 2020 15:26:59 +0800 Message-ID: <20200604072708.9468-10-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604072708.9468-1-xia.jiang@mediatek.com> References: <20200604072708.9468-1-xia.jiang@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 Delete zeroing the reserved fields because that the core already does it. Signed-off-by: Xia Jiang --- v9: new patch --- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 5 ----- 1 file changed, 5 deletions(-) -- 2.18.0 diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index bb4ebce881ee..bd1cc58324c6 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -198,7 +198,6 @@ static int mtk_jpeg_try_fmt_mplane(struct v4l2_format *f, struct mtk_jpeg_dev *jpeg = ctx->jpeg; int i; - memset(pix_mp->reserved, 0, sizeof(pix_mp->reserved)); pix_mp->field = V4L2_FIELD_NONE; if (ctx->state != MTK_JPEG_INIT) { @@ -217,7 +216,6 @@ static int mtk_jpeg_try_fmt_mplane(struct v4l2_format *f, &pix_mp->height, MTK_JPEG_MIN_HEIGHT, MTK_JPEG_MAX_HEIGHT, 0); - memset(pfmt->reserved, 0, sizeof(pfmt->reserved)); pfmt->bytesperline = 0; /* Source size must be aligned to 128 */ pfmt->sizeimage = mtk_jpeg_align(pfmt->sizeimage, 128); @@ -237,7 +235,6 @@ static int mtk_jpeg_try_fmt_mplane(struct v4l2_format *f, u32 stride = pix_mp->width * fmt->h_sample[i] / 4; u32 h = pix_mp->height * fmt->v_sample[i] / 4; - memset(pfmt->reserved, 0, sizeof(pfmt->reserved)); pfmt->bytesperline = stride; pfmt->sizeimage = stride * h; } @@ -270,7 +267,6 @@ static int mtk_jpeg_g_fmt_vid_mplane(struct file *file, void *priv, q_data = mtk_jpeg_get_q_data(ctx, f->type); - memset(pix_mp->reserved, 0, sizeof(pix_mp->reserved)); pix_mp->width = q_data->w; pix_mp->height = q_data->h; pix_mp->field = V4L2_FIELD_NONE; @@ -294,7 +290,6 @@ static int mtk_jpeg_g_fmt_vid_mplane(struct file *file, void *priv, pfmt->bytesperline = q_data->bytesperline[i]; pfmt->sizeimage = q_data->sizeimage[i]; - memset(pfmt->reserved, 0, sizeof(pfmt->reserved)); v4l2_dbg(1, debug, &jpeg->v4l2_dev, "plane[%d] bpl=%u, size=%u\n", From patchwork Thu Jun 4 07:27:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209634 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, 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 3B8A7C433DF for ; Thu, 4 Jun 2020 07:30:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 10D1420663 for ; Thu, 4 Jun 2020 07:30:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="b+0grvAY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727995AbgFDH3f (ORCPT ); Thu, 4 Jun 2020 03:29:35 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:2854 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728094AbgFDH3e (ORCPT ); Thu, 4 Jun 2020 03:29:34 -0400 X-UUID: 434d868eed3f4f31b7d212a468f850ba-20200604 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=ruv+enB5poqyL/I1yboqzGHbyq2HlfaaeUs84iv1Mk0=; b=b+0grvAY6QKowBO6kie2tNZWGY1G0dMc5TyoIf3q5OVv+eXIhcYvzzzmBDDGhaCF15yCqZmBy8YgdhRCa2siDHdPzLIdCi/R2S3m5QqlO5/MZHtbI8pawTUuBgj/nLyJcr+VL4vIuph0y6z7GhiW+m6treSCBVMpqe/V8e+bPto=; X-UUID: 434d868eed3f4f31b7d212a468f850ba-20200604 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 285516766; Thu, 04 Jun 2020 15:29:31 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 15:29:28 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 4 Jun 2020 15:29:26 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Rick Chang CC: , , , , , Marek Szyprowski , Tomasz Figa , , , , , , , Xia Jiang Subject: [PATCH v9 12/18] media: platform: Change MTK_JPEG_COMP_MAX macro definition location Date: Thu, 4 Jun 2020 15:27:02 +0800 Message-ID: <20200604072708.9468-13-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604072708.9468-1-xia.jiang@mediatek.com> References: <20200604072708.9468-1-xia.jiang@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 Move MTK_JPEG_COMP_MAX definition to mtk_jpeg_core.h file, because it is used by mtk_jpeg_core.c file. Reviewed-by: Tomasz Figa Signed-off-by: Xia Jiang --- v9: no changes --- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h | 2 ++ drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) -- 2.18.0 diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h index 28e9b30ad5c3..64a731261214 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h @@ -15,6 +15,8 @@ #define MTK_JPEG_NAME "mtk-jpeg" +#define MTK_JPEG_COMP_MAX 3 + #define MTK_JPEG_FMT_FLAG_DEC_OUTPUT BIT(0) #define MTK_JPEG_FMT_FLAG_DEC_CAPTURE BIT(1) diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h index 2945da842dfa..21ec8f96797f 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h @@ -8,7 +8,6 @@ #ifndef _MTK_JPEG_REG_H #define _MTK_JPEG_REG_H -#define MTK_JPEG_COMP_MAX 3 #define MTK_JPEG_BLOCK_MAX 10 #define MTK_JPEG_DCTSIZE 8 From patchwork Thu Jun 4 07:27:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209635 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, 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 1C1F4C433DF for ; Thu, 4 Jun 2020 07:30:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB41F20663 for ; Thu, 4 Jun 2020 07:30:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="cbRWclWV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728133AbgFDH3i (ORCPT ); Thu, 4 Jun 2020 03:29:38 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:28869 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728108AbgFDH3g (ORCPT ); Thu, 4 Jun 2020 03:29:36 -0400 X-UUID: af6a607076b4424283efc1af5cec588b-20200604 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=5ePcRgV/lHp7UcC/6PvykABEajI6oWw2EQVEmJvp6Qk=; b=cbRWclWVFZTwIjXeeUAQJOg+8VC6bFuizTZeAsJAP+yNlR6Hr4GoEJi5BeF4HR4WaUWcdVtym0DUDPGQNw1KNwk4jikh0AB3su0T5unCLielnXJ3YqJqFeChdM97KuF6B3RDBXofN2q1GkJs5/HGQzJDXjLCnxw1ZdTRKp0E6/s=; X-UUID: af6a607076b4424283efc1af5cec588b-20200604 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 48519200; Thu, 04 Jun 2020 15:29:31 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 15:29:29 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 4 Jun 2020 15:29:28 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Rick Chang CC: , , , , , Marek Szyprowski , Tomasz Figa , , , , , , , Xia Jiang Subject: [PATCH v9 13/18] media: platform: Delete redundant code and add annotation for an enum Date: Thu, 4 Jun 2020 15:27:03 +0800 Message-ID: <20200604072708.9468-14-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604072708.9468-1-xia.jiang@mediatek.com> References: <20200604072708.9468-1-xia.jiang@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 Delete unused member variables annotation. Delete unused variable definition. Delete redundant log print, because V4L2 debug logs already print it. Add annotation for enum mtk_jpeg_ctx_state. Signed-off-by: Xia Jiang --- v9: add annotation for enum mtk_jpeg_ctx_state --- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 15 ++------------- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h | 8 ++++++-- 2 files changed, 8 insertions(+), 15 deletions(-) -- 2.18.0 diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index c9c0357b2d6c..6c82134d6b3d 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -176,14 +176,13 @@ static int mtk_jpeg_try_fmt_mplane(struct v4l2_format *f, struct mtk_jpeg_ctx *ctx, int q_type) { struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp; - struct mtk_jpeg_dev *jpeg = ctx->jpeg; int i; pix_mp->field = V4L2_FIELD_NONE; if (ctx->state != MTK_JPEG_INIT) { mtk_jpeg_adjust_fmt_mplane(ctx, f); - goto end; + return 0; } pix_mp->num_planes = fmt->colplanes; @@ -202,7 +201,7 @@ static int mtk_jpeg_try_fmt_mplane(struct v4l2_format *f, pfmt->sizeimage = round_up(pfmt->sizeimage, 128); if (pfmt->sizeimage == 0) pfmt->sizeimage = MTK_JPEG_DEFAULT_SIZEIMAGE; - goto end; + return 0; } /* type is MTK_JPEG_FMT_TYPE_CAPTURE */ @@ -219,16 +218,6 @@ static int mtk_jpeg_try_fmt_mplane(struct v4l2_format *f, pfmt->bytesperline = stride; pfmt->sizeimage = stride * h; } -end: - v4l2_dbg(2, debug, &jpeg->v4l2_dev, "wxh:%ux%u\n", - pix_mp->width, pix_mp->height); - for (i = 0; i < pix_mp->num_planes; i++) { - v4l2_dbg(2, debug, &jpeg->v4l2_dev, - "plane[%d] bpl=%u, size=%u\n", - i, - pix_mp->plane_fmt[i].bytesperline, - pix_mp->plane_fmt[i].sizeimage); - } return 0; } diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h index 64a731261214..5fcdf6950782 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h @@ -30,6 +30,12 @@ #define MTK_JPEG_DEFAULT_SIZEIMAGE (1 * 1024 * 1024) +/** + * enum mtk_jpeg_ctx_state - states of the context state machine + * @MTK_JPEG_INIT: current state is initialized + * @MTK_JPEG_RUNNING: current state is running + * @MTK_JPEG_SOURCE_CHANGE: current state is source resolution change + */ enum mtk_jpeg_ctx_state { MTK_JPEG_INIT = 0, MTK_JPEG_RUNNING, @@ -109,9 +115,7 @@ struct mtk_jpeg_q_data { * @out_q: source (output) queue information * @cap_q: destination (capture) queue queue information * @fh: V4L2 file handle - * @dec_param parameters for HW decoding * @state: state of the context - * @header_valid: set if header has been parsed and valid * @colorspace: enum v4l2_colorspace; supplemental to pixelformat * @ycbcr_enc: enum v4l2_ycbcr_encoding, Y'CbCr encoding * @quantization: enum v4l2_quantization, colorspace quantization From patchwork Thu Jun 4 07:27:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209636 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, 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 5B0C4C433DF for ; Thu, 4 Jun 2020 07:30:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D6C52072E for ; Thu, 4 Jun 2020 07:30:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="BpQDzp3D" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728254AbgFDHaQ (ORCPT ); Thu, 4 Jun 2020 03:30:16 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:7383 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728139AbgFDH3m (ORCPT ); Thu, 4 Jun 2020 03:29:42 -0400 X-UUID: d72a4d305ba246bfadc4388ffef4f760-20200604 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=++AszAM+yvHiRrZuadM5z42ebHxNTFGklmlvhyXuUcg=; b=BpQDzp3DKHtzCoGCWFiwCjBT4de9BRGMGSYd8+j0LrqMVkO2Ul6jlMWwcp1EZjufo+gIGPv4e/bpzP/eV0wH8juVUKWqVNfmNqMOGWax3lkjwdJSNK87VgY1GvYEUwP1UItNr6slXhu1GBevRkGNBI5HfrfGWrHzXP7RFf35xnk=; X-UUID: d72a4d305ba246bfadc4388ffef4f760-20200604 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1955025006; Thu, 04 Jun 2020 15:29:36 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 15:29:33 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 4 Jun 2020 15:29:31 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Rick Chang CC: , , , , , Marek Szyprowski , Tomasz Figa , , , , , , , Xia Jiang Subject: [PATCH v9 16/18] media: platform: Rename jpeg dec file name Date: Thu, 4 Jun 2020 15:27:06 +0800 Message-ID: <20200604072708.9468-17-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604072708.9468-1-xia.jiang@mediatek.com> References: <20200604072708.9468-1-xia.jiang@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 Rename the files which are for decode feature. This is preparing path since the jpeg enc patch will be added later. Reviewed-by: Tomasz Figa Signed-off-by: Xia Jiang --- v9: no changes --- drivers/media/platform/mtk-jpeg/Makefile | 2 +- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 4 ++-- .../platform/mtk-jpeg/{mtk_jpeg_hw.c => mtk_jpeg_dec_hw.c} | 2 +- .../platform/mtk-jpeg/{mtk_jpeg_hw.h => mtk_jpeg_dec_hw.h} | 2 +- .../mtk-jpeg/{mtk_jpeg_parse.c => mtk_jpeg_dec_parse.c} | 2 +- .../mtk-jpeg/{mtk_jpeg_parse.h => mtk_jpeg_dec_parse.h} | 2 +- .../platform/mtk-jpeg/{mtk_jpeg_reg.h => mtk_jpeg_dec_reg.h} | 0 7 files changed, 7 insertions(+), 7 deletions(-) rename drivers/media/platform/mtk-jpeg/{mtk_jpeg_hw.c => mtk_jpeg_dec_hw.c} (99%) rename drivers/media/platform/mtk-jpeg/{mtk_jpeg_hw.h => mtk_jpeg_dec_hw.h} (98%) rename drivers/media/platform/mtk-jpeg/{mtk_jpeg_parse.c => mtk_jpeg_dec_parse.c} (98%) rename drivers/media/platform/mtk-jpeg/{mtk_jpeg_parse.h => mtk_jpeg_dec_parse.h} (92%) rename drivers/media/platform/mtk-jpeg/{mtk_jpeg_reg.h => mtk_jpeg_dec_reg.h} (100%) -- 2.18.0 diff --git a/drivers/media/platform/mtk-jpeg/Makefile b/drivers/media/platform/mtk-jpeg/Makefile index 92a4fc046bfe..48516dcf96e6 100644 --- a/drivers/media/platform/mtk-jpeg/Makefile +++ b/drivers/media/platform/mtk-jpeg/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -mtk_jpeg-objs := mtk_jpeg_core.o mtk_jpeg_hw.o mtk_jpeg_parse.o +mtk_jpeg-objs := mtk_jpeg_core.o mtk_jpeg_dec_hw.o mtk_jpeg_dec_parse.o obj-$(CONFIG_VIDEO_MEDIATEK_JPEG) += mtk_jpeg.o diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 6c82134d6b3d..e0e522a502e1 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -23,9 +23,9 @@ #include #include -#include "mtk_jpeg_hw.h" +#include "mtk_jpeg_dec_hw.h" #include "mtk_jpeg_core.h" -#include "mtk_jpeg_parse.h" +#include "mtk_jpeg_dec_parse.h" static struct mtk_jpeg_fmt mtk_jpeg_formats[] = { { diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.c similarity index 99% rename from drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.c rename to drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.c index 68abcfd7494d..afbbfd5d02bc 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.c @@ -9,7 +9,7 @@ #include #include -#include "mtk_jpeg_hw.h" +#include "mtk_jpeg_dec_hw.h" #define MTK_JPEG_DUNUM_MASK(val) (((val) - 1) & 0x3) diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h similarity index 98% rename from drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.h rename to drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h index 7b0687f8f4b6..1cc37dbfc8e7 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.h +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h @@ -11,7 +11,7 @@ #include #include "mtk_jpeg_core.h" -#include "mtk_jpeg_reg.h" +#include "mtk_jpeg_dec_reg.h" enum { MTK_JPEG_DEC_RESULT_EOF_DONE = 0, diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_parse.c similarity index 98% rename from drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.c rename to drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_parse.c index f862d38f3af7..b95c45791c29 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_parse.c @@ -8,7 +8,7 @@ #include #include -#include "mtk_jpeg_parse.h" +#include "mtk_jpeg_dec_parse.h" #define TEM 0x01 #define SOF0 0xc0 diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_parse.h similarity index 92% rename from drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.h rename to drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_parse.h index 0a48eeabaff2..2918f15811f8 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.h +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_parse.h @@ -8,7 +8,7 @@ #ifndef _MTK_JPEG_PARSE_H #define _MTK_JPEG_PARSE_H -#include "mtk_jpeg_hw.h" +#include "mtk_jpeg_dec_hw.h" bool mtk_jpeg_parse(struct mtk_jpeg_dec_param *param, u8 *src_addr_va, u32 src_size); diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_reg.h similarity index 100% rename from drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h rename to drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_reg.h From patchwork Thu Jun 4 07:27:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209637 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 B7DA0C433E0 for ; Thu, 4 Jun 2020 07:29:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 851342072E for ; Thu, 4 Jun 2020 07:29:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="DqYqpm1/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728177AbgFDH3p (ORCPT ); Thu, 4 Jun 2020 03:29:45 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:1374 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728145AbgFDH3p (ORCPT ); Thu, 4 Jun 2020 03:29:45 -0400 X-UUID: f159f1d61e624658a837e44e07e2d8e7-20200604 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=ylDEr3lfKwEawoYHpqUoyNEwFxVCxmRB4bljVi40+Jw=; b=DqYqpm1/+15ErFiX6i9L+AloGMX80VAua9Ba79XosgT+BR1Ev8HVva8Aa2ZBeIfbt6+h4iTaRhWuOakNSZNMtdu7yxwmXpTd/UN8+E1yE2dCrwPio53csBwzreoV69OtvvM0ao76NugOHfO/5DLQUQplyePQbLCJmHjinJ5zvzE=; X-UUID: f159f1d61e624658a837e44e07e2d8e7-20200604 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1337255306; Thu, 04 Jun 2020 15:29:38 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 15:29:34 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 4 Jun 2020 15:29:33 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Rick Chang CC: , , , , , Marek Szyprowski , Tomasz Figa , , , , , , , Xia Jiang Subject: [PATCH v9 17/18] media: platform: Rename existing functions/defines/variables Date: Thu, 4 Jun 2020 15:27:07 +0800 Message-ID: <20200604072708.9468-18-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604072708.9468-1-xia.jiang@mediatek.com> References: <20200604072708.9468-1-xia.jiang@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 Rename existing funcitons/defines/variables with a _dec prefix and without dec_ prefix to prepare for the addition of the jpeg encoder feature. Signed-off-by: Xia Jiang --- v9: new patch --- .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 196 +++++++++--------- .../media/platform/mtk-jpeg/mtk_jpeg_core.h | 8 +- .../media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h | 7 +- 3 files changed, 107 insertions(+), 104 deletions(-) -- 2.18.0 diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index e0e522a502e1..8d5a78c775a6 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -27,7 +27,7 @@ #include "mtk_jpeg_core.h" #include "mtk_jpeg_dec_parse.h" -static struct mtk_jpeg_fmt mtk_jpeg_formats[] = { +static struct mtk_jpeg_fmt mtk_jpeg_dec_formats[] = { { .fourcc = V4L2_PIX_FMT_JPEG, .colplanes = 1, @@ -53,7 +53,7 @@ static struct mtk_jpeg_fmt mtk_jpeg_formats[] = { }, }; -#define MTK_JPEG_NUM_FORMATS ARRAY_SIZE(mtk_jpeg_formats) +#define MTK_JPEG_DEC_NUM_FORMATS ARRAY_SIZE(mtk_jpeg_dec_formats) struct mtk_jpeg_src_buf { struct vb2_v4l2_buffer b; @@ -75,12 +75,12 @@ static inline struct mtk_jpeg_src_buf *mtk_jpeg_vb2_to_srcbuf( return container_of(to_vb2_v4l2_buffer(vb), struct mtk_jpeg_src_buf, b); } -static int mtk_jpeg_querycap(struct file *file, void *priv, +static int mtk_jpeg_dec_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { struct mtk_jpeg_dev *jpeg = video_drvdata(file); - strscpy(cap->driver, MTK_JPEG_NAME " decoder", sizeof(cap->driver)); + strscpy(cap->driver, MTK_JPEG_NAME, sizeof(cap->driver)); strscpy(cap->card, MTK_JPEG_NAME " decoder", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(jpeg->dev)); @@ -109,22 +109,23 @@ static int mtk_jpeg_enum_fmt(struct mtk_jpeg_fmt *mtk_jpeg_formats, int n, return 0; } -static int mtk_jpeg_enum_fmt_vid_cap(struct file *file, void *priv, - struct v4l2_fmtdesc *f) +static int mtk_jpeg_dec_enum_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_fmtdesc *f) { - return mtk_jpeg_enum_fmt(mtk_jpeg_formats, MTK_JPEG_NUM_FORMATS, f, + return mtk_jpeg_enum_fmt(mtk_jpeg_dec_formats, + MTK_JPEG_DEC_NUM_FORMATS, f, MTK_JPEG_FMT_FLAG_DEC_CAPTURE); } -static int mtk_jpeg_enum_fmt_vid_out(struct file *file, void *priv, - struct v4l2_fmtdesc *f) +static int mtk_jpeg_dec_enum_fmt_vid_out(struct file *file, void *priv, + struct v4l2_fmtdesc *f) { - return mtk_jpeg_enum_fmt(mtk_jpeg_formats, MTK_JPEG_NUM_FORMATS, f, - MTK_JPEG_FMT_FLAG_DEC_OUTPUT); + return mtk_jpeg_enum_fmt(mtk_jpeg_dec_formats, MTK_JPEG_DEC_NUM_FORMATS, + f, MTK_JPEG_FMT_FLAG_DEC_OUTPUT); } -static struct mtk_jpeg_q_data *mtk_jpeg_get_q_data(struct mtk_jpeg_ctx *ctx, - enum v4l2_buf_type type) +static struct mtk_jpeg_q_data * +mtk_jpeg_get_q_data(struct mtk_jpeg_ctx *ctx, enum v4l2_buf_type type) { if (V4L2_TYPE_IS_OUTPUT(type)) return &ctx->out_q; @@ -141,8 +142,8 @@ static struct mtk_jpeg_fmt *mtk_jpeg_find_format(struct mtk_jpeg_ctx *ctx, MTK_JPEG_FMT_FLAG_DEC_OUTPUT : MTK_JPEG_FMT_FLAG_DEC_CAPTURE; - for (k = 0; k < MTK_JPEG_NUM_FORMATS; k++) { - struct mtk_jpeg_fmt *fmt = &mtk_jpeg_formats[k]; + for (k = 0; k < MTK_JPEG_DEC_NUM_FORMATS; k++) { + struct mtk_jpeg_fmt *fmt = &mtk_jpeg_dec_formats[k]; if (fmt->fourcc == pixelformat && fmt->flags & fmt_flag) return fmt; @@ -270,8 +271,8 @@ static int mtk_jpeg_g_fmt_vid_mplane(struct file *file, void *priv, return 0; } -static int mtk_jpeg_try_fmt_vid_cap_mplane(struct file *file, void *priv, - struct v4l2_format *f) +static int mtk_jpeg_dec_try_fmt_vid_cap_mplane(struct file *file, void *priv, + struct v4l2_format *f) { struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv); struct mtk_jpeg_fmt *fmt; @@ -291,8 +292,8 @@ static int mtk_jpeg_try_fmt_vid_cap_mplane(struct file *file, void *priv, return mtk_jpeg_try_fmt_mplane(f, fmt, ctx, MTK_JPEG_FMT_TYPE_CAPTURE); } -static int mtk_jpeg_try_fmt_vid_out_mplane(struct file *file, void *priv, - struct v4l2_format *f) +static int mtk_jpeg_dec_try_fmt_vid_out_mplane(struct file *file, void *priv, + struct v4l2_format *f) { struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv); struct mtk_jpeg_fmt *fmt; @@ -364,24 +365,24 @@ static int mtk_jpeg_s_fmt_mplane(struct mtk_jpeg_ctx *ctx, return 0; } -static int mtk_jpeg_s_fmt_vid_out_mplane(struct file *file, void *priv, - struct v4l2_format *f) +static int mtk_jpeg_dec_s_fmt_vid_out_mplane(struct file *file, void *priv, + struct v4l2_format *f) { int ret; - ret = mtk_jpeg_try_fmt_vid_out_mplane(file, priv, f); + ret = mtk_jpeg_dec_try_fmt_vid_out_mplane(file, priv, f); if (ret) return ret; return mtk_jpeg_s_fmt_mplane(mtk_jpeg_fh_to_ctx(priv), f); } -static int mtk_jpeg_s_fmt_vid_cap_mplane(struct file *file, void *priv, - struct v4l2_format *f) +static int mtk_jpeg_dec_s_fmt_vid_cap_mplane(struct file *file, void *priv, + struct v4l2_format *f) { int ret; - ret = mtk_jpeg_try_fmt_vid_cap_mplane(file, priv, f); + ret = mtk_jpeg_dec_try_fmt_vid_cap_mplane(file, priv, f); if (ret) return ret; @@ -410,8 +411,8 @@ static int mtk_jpeg_subscribe_event(struct v4l2_fh *fh, return v4l2_ctrl_subscribe_event(fh, sub); } -static int mtk_jpeg_g_selection(struct file *file, void *priv, - struct v4l2_selection *s) +static int mtk_jpeg_dec_g_selection(struct file *file, void *priv, + struct v4l2_selection *s) { struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv); @@ -439,8 +440,8 @@ static int mtk_jpeg_g_selection(struct file *file, void *priv, return 0; } -static int mtk_jpeg_s_selection(struct file *file, void *priv, - struct v4l2_selection *s) +static int mtk_jpeg_dec_s_selection(struct file *file, void *priv, + struct v4l2_selection *s) { struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv); @@ -483,20 +484,20 @@ static int mtk_jpeg_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) return v4l2_m2m_qbuf(file, fh->m2m_ctx, buf); } -static const struct v4l2_ioctl_ops mtk_jpeg_ioctl_ops = { - .vidioc_querycap = mtk_jpeg_querycap, - .vidioc_enum_fmt_vid_cap = mtk_jpeg_enum_fmt_vid_cap, - .vidioc_enum_fmt_vid_out = mtk_jpeg_enum_fmt_vid_out, - .vidioc_try_fmt_vid_cap_mplane = mtk_jpeg_try_fmt_vid_cap_mplane, - .vidioc_try_fmt_vid_out_mplane = mtk_jpeg_try_fmt_vid_out_mplane, +static const struct v4l2_ioctl_ops mtk_jpeg_dec_ioctl_ops = { + .vidioc_querycap = mtk_jpeg_dec_querycap, + .vidioc_enum_fmt_vid_cap = mtk_jpeg_dec_enum_fmt_vid_cap, + .vidioc_enum_fmt_vid_out = mtk_jpeg_dec_enum_fmt_vid_out, + .vidioc_try_fmt_vid_cap_mplane = mtk_jpeg_dec_try_fmt_vid_cap_mplane, + .vidioc_try_fmt_vid_out_mplane = mtk_jpeg_dec_try_fmt_vid_out_mplane, .vidioc_g_fmt_vid_cap_mplane = mtk_jpeg_g_fmt_vid_mplane, .vidioc_g_fmt_vid_out_mplane = mtk_jpeg_g_fmt_vid_mplane, - .vidioc_s_fmt_vid_cap_mplane = mtk_jpeg_s_fmt_vid_cap_mplane, - .vidioc_s_fmt_vid_out_mplane = mtk_jpeg_s_fmt_vid_out_mplane, + .vidioc_s_fmt_vid_cap_mplane = mtk_jpeg_dec_s_fmt_vid_cap_mplane, + .vidioc_s_fmt_vid_out_mplane = mtk_jpeg_dec_s_fmt_vid_out_mplane, .vidioc_qbuf = mtk_jpeg_qbuf, .vidioc_subscribe_event = mtk_jpeg_subscribe_event, - .vidioc_g_selection = mtk_jpeg_g_selection, - .vidioc_s_selection = mtk_jpeg_s_selection, + .vidioc_g_selection = mtk_jpeg_dec_g_selection, + .vidioc_s_selection = mtk_jpeg_dec_s_selection, .vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs, .vidioc_prepare_buf = v4l2_m2m_ioctl_prepare_buf, @@ -615,7 +616,7 @@ static void mtk_jpeg_set_queue_data(struct mtk_jpeg_ctx *ctx, param->dec_w, param->dec_h); } -static void mtk_jpeg_buf_queue(struct vb2_buffer *vb) +static void mtk_jpeg_dec_buf_queue(struct vb2_buffer *vb) { struct mtk_jpeg_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); struct mtk_jpeg_dec_param *param; @@ -663,7 +664,7 @@ static struct vb2_v4l2_buffer *mtk_jpeg_buf_remove(struct mtk_jpeg_ctx *ctx, return v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); } -static void mtk_jpeg_stop_streaming(struct vb2_queue *q) +static void mtk_jpeg_dec_stop_streaming(struct vb2_queue *q) { struct mtk_jpeg_ctx *ctx = vb2_get_drv_priv(q); struct vb2_v4l2_buffer *vb; @@ -689,13 +690,13 @@ static void mtk_jpeg_stop_streaming(struct vb2_queue *q) v4l2_m2m_buf_done(vb, VB2_BUF_STATE_ERROR); } -static const struct vb2_ops mtk_jpeg_qops = { +static const struct vb2_ops mtk_jpeg_dec_qops = { .queue_setup = mtk_jpeg_queue_setup, .buf_prepare = mtk_jpeg_buf_prepare, - .buf_queue = mtk_jpeg_buf_queue, + .buf_queue = mtk_jpeg_dec_buf_queue, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, - .stop_streaming = mtk_jpeg_stop_streaming, + .stop_streaming = mtk_jpeg_dec_stop_streaming, }; static void mtk_jpeg_set_dec_src(struct mtk_jpeg_ctx *ctx, @@ -735,7 +736,7 @@ static int mtk_jpeg_set_dec_dst(struct mtk_jpeg_ctx *ctx, return 0; } -static void mtk_jpeg_device_run(void *priv) +static void mtk_jpeg_dec_device_run(void *priv) { struct mtk_jpeg_ctx *ctx = priv; struct mtk_jpeg_dev *jpeg = ctx->jpeg; @@ -763,15 +764,16 @@ static void mtk_jpeg_device_run(void *priv) goto dec_end; mtk_jpeg_set_dec_src(ctx, &src_buf->vb2_buf, &bs); - if (mtk_jpeg_set_dec_dst(ctx, &jpeg_src_buf->dec_param, &dst_buf->vb2_buf, &fb)) + if (mtk_jpeg_set_dec_dst(ctx, &jpeg_src_buf->dec_param, + &dst_buf->vb2_buf, &fb)) goto dec_end; spin_lock_irqsave(&jpeg->hw_lock, flags); - mtk_jpeg_dec_reset(jpeg->dec_reg_base); - mtk_jpeg_dec_set_config(jpeg->dec_reg_base, + mtk_jpeg_dec_reset(jpeg->reg_base); + mtk_jpeg_dec_set_config(jpeg->reg_base, &jpeg_src_buf->dec_param, &bs, &fb); - mtk_jpeg_dec_start(jpeg->dec_reg_base); + mtk_jpeg_dec_start(jpeg->reg_base); spin_unlock_irqrestore(&jpeg->hw_lock, flags); return; @@ -783,19 +785,19 @@ static void mtk_jpeg_device_run(void *priv) v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx); } -static int mtk_jpeg_job_ready(void *priv) +static int mtk_jpeg_dec_job_ready(void *priv) { struct mtk_jpeg_ctx *ctx = priv; return (ctx->state == MTK_JPEG_RUNNING) ? 1 : 0; } -static const struct v4l2_m2m_ops mtk_jpeg_m2m_ops = { - .device_run = mtk_jpeg_device_run, - .job_ready = mtk_jpeg_job_ready, +static const struct v4l2_m2m_ops mtk_jpeg_dec_m2m_ops = { + .device_run = mtk_jpeg_dec_device_run, + .job_ready = mtk_jpeg_dec_job_ready, }; -static int mtk_jpeg_queue_init(void *priv, struct vb2_queue *src_vq, +static int mtk_jpeg_dec_queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq) { struct mtk_jpeg_ctx *ctx = priv; @@ -805,7 +807,7 @@ static int mtk_jpeg_queue_init(void *priv, struct vb2_queue *src_vq, src_vq->io_modes = VB2_DMABUF | VB2_MMAP; src_vq->drv_priv = ctx; src_vq->buf_struct_size = sizeof(struct mtk_jpeg_src_buf); - src_vq->ops = &mtk_jpeg_qops; + src_vq->ops = &mtk_jpeg_dec_qops; src_vq->mem_ops = &vb2_dma_contig_memops; src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; src_vq->lock = &ctx->jpeg->lock; @@ -818,7 +820,7 @@ static int mtk_jpeg_queue_init(void *priv, struct vb2_queue *src_vq, dst_vq->io_modes = VB2_DMABUF | VB2_MMAP; dst_vq->drv_priv = ctx; dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); - dst_vq->ops = &mtk_jpeg_qops; + dst_vq->ops = &mtk_jpeg_dec_qops; dst_vq->mem_ops = &vb2_dma_contig_memops; dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; dst_vq->lock = &ctx->jpeg->lock; @@ -857,7 +859,7 @@ static irqreturn_t mtk_jpeg_dec_irq(int irq, void *priv) u32 dec_ret; int i; - dec_ret = mtk_jpeg_dec_get_int_status(jpeg->dec_reg_base); + dec_ret = mtk_jpeg_dec_get_int_status(jpeg->reg_base); dec_irq_ret = mtk_jpeg_dec_enum_result(dec_ret); ctx = v4l2_m2m_get_curr_priv(jpeg->m2m_dev); if (!ctx) { @@ -870,7 +872,7 @@ static irqreturn_t mtk_jpeg_dec_irq(int irq, void *priv) jpeg_src_buf = mtk_jpeg_vb2_to_srcbuf(&src_buf->vb2_buf); if (dec_irq_ret >= MTK_JPEG_DEC_RESULT_UNDERFLOW) - mtk_jpeg_dec_reset(jpeg->dec_reg_base); + mtk_jpeg_dec_reset(jpeg->reg_base); if (dec_irq_ret != MTK_JPEG_DEC_RESULT_EOF_DONE) { dev_err(jpeg->dev, "decode failed\n"); @@ -891,7 +893,7 @@ static irqreturn_t mtk_jpeg_dec_irq(int irq, void *priv) return IRQ_HANDLED; } -static void mtk_jpeg_set_default_params(struct mtk_jpeg_ctx *ctx) +static void mtk_jpeg_set_dec_default_params(struct mtk_jpeg_ctx *ctx) { struct mtk_jpeg_q_data *q = &ctx->out_q; int i; @@ -923,7 +925,7 @@ static void mtk_jpeg_set_default_params(struct mtk_jpeg_ctx *ctx) } } -static int mtk_jpeg_open(struct file *file) +static int mtk_jpeg_dec_open(struct file *file) { struct mtk_jpeg_dev *jpeg = video_drvdata(file); struct video_device *vfd = video_devdata(file); @@ -945,13 +947,13 @@ static int mtk_jpeg_open(struct file *file) ctx->jpeg = jpeg; ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(jpeg->m2m_dev, ctx, - mtk_jpeg_queue_init); + mtk_jpeg_dec_queue_init); if (IS_ERR(ctx->fh.m2m_ctx)) { ret = PTR_ERR(ctx->fh.m2m_ctx); goto error; } - mtk_jpeg_set_default_params(ctx); + mtk_jpeg_set_dec_default_params(ctx); mutex_unlock(&jpeg->lock); return 0; @@ -978,9 +980,9 @@ static int mtk_jpeg_release(struct file *file) return 0; } -static const struct v4l2_file_operations mtk_jpeg_fops = { +static const struct v4l2_file_operations mtk_jpeg_dec_fops = { .owner = THIS_MODULE, - .open = mtk_jpeg_open, + .open = mtk_jpeg_dec_open, .release = mtk_jpeg_release, .poll = v4l2_m2m_fop_poll, .unlocked_ioctl = video_ioctl2, @@ -1016,7 +1018,7 @@ static int mtk_jpeg_probe(struct platform_device *pdev) { struct mtk_jpeg_dev *jpeg; struct resource *res; - int dec_irq; + int jpeg_irq; int ret; jpeg = devm_kzalloc(&pdev->dev, sizeof(*jpeg), GFP_KERNEL); @@ -1028,23 +1030,23 @@ static int mtk_jpeg_probe(struct platform_device *pdev) jpeg->dev = &pdev->dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - jpeg->dec_reg_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(jpeg->dec_reg_base)) { - ret = PTR_ERR(jpeg->dec_reg_base); + jpeg->reg_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(jpeg->reg_base)) { + ret = PTR_ERR(jpeg->reg_base); return ret; } - dec_irq = platform_get_irq(pdev, 0); - if (dec_irq < 0) { - dev_err(&pdev->dev, "Failed to get dec_irq %d.\n", dec_irq); - return dec_irq; + jpeg_irq = platform_get_irq(pdev, 0); + if (jpeg_irq < 0) { + dev_err(&pdev->dev, "Failed to get jpeg_irq %d.\n", jpeg_irq); + return jpeg_irq; } - ret = devm_request_irq(&pdev->dev, dec_irq, mtk_jpeg_dec_irq, 0, + ret = devm_request_irq(&pdev->dev, jpeg_irq, mtk_jpeg_dec_irq, 0, pdev->name, jpeg); if (ret) { - dev_err(&pdev->dev, "Failed to request dec_irq %d (%d)\n", - dec_irq, ret); + dev_err(&pdev->dev, "Failed to request jpeg_irq %d (%d)\n", + jpeg_irq, ret); goto err_req_irq; } @@ -1061,40 +1063,40 @@ static int mtk_jpeg_probe(struct platform_device *pdev) goto err_dev_register; } - jpeg->m2m_dev = v4l2_m2m_init(&mtk_jpeg_m2m_ops); + jpeg->m2m_dev = v4l2_m2m_init(&mtk_jpeg_dec_m2m_ops); if (IS_ERR(jpeg->m2m_dev)) { v4l2_err(&jpeg->v4l2_dev, "Failed to init mem2mem device\n"); ret = PTR_ERR(jpeg->m2m_dev); goto err_m2m_init; } - jpeg->dec_vdev = video_device_alloc(); - if (!jpeg->dec_vdev) { + jpeg->vdev = video_device_alloc(); + if (!jpeg->vdev) { ret = -ENOMEM; - goto err_dec_vdev_alloc; + goto err_vfd_jpeg_alloc; } - snprintf(jpeg->dec_vdev->name, sizeof(jpeg->dec_vdev->name), + snprintf(jpeg->vdev->name, sizeof(jpeg->vdev->name), "%s-dec", MTK_JPEG_NAME); - jpeg->dec_vdev->fops = &mtk_jpeg_fops; - jpeg->dec_vdev->ioctl_ops = &mtk_jpeg_ioctl_ops; - jpeg->dec_vdev->minor = -1; - jpeg->dec_vdev->release = video_device_release; - jpeg->dec_vdev->lock = &jpeg->lock; - jpeg->dec_vdev->v4l2_dev = &jpeg->v4l2_dev; - jpeg->dec_vdev->vfl_dir = VFL_DIR_M2M; - jpeg->dec_vdev->device_caps = V4L2_CAP_STREAMING | + jpeg->vdev->fops = &mtk_jpeg_dec_fops; + jpeg->vdev->ioctl_ops = &mtk_jpeg_dec_ioctl_ops; + jpeg->vdev->minor = -1; + jpeg->vdev->release = video_device_release; + jpeg->vdev->lock = &jpeg->lock; + jpeg->vdev->v4l2_dev = &jpeg->v4l2_dev; + jpeg->vdev->vfl_dir = VFL_DIR_M2M; + jpeg->vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE; - ret = video_register_device(jpeg->dec_vdev, VFL_TYPE_VIDEO, -1); + ret = video_register_device(jpeg->vdev, VFL_TYPE_VIDEO, -1); if (ret) { v4l2_err(&jpeg->v4l2_dev, "Failed to register video device\n"); - goto err_dec_vdev_register; + goto err_vfd_jpeg_register; } - video_set_drvdata(jpeg->dec_vdev, jpeg); + video_set_drvdata(jpeg->vdev, jpeg); v4l2_info(&jpeg->v4l2_dev, "decoder device registered as /dev/video%d (%d,%d)\n", - jpeg->dec_vdev->num, VIDEO_MAJOR, jpeg->dec_vdev->minor); + jpeg->vdev->num, VIDEO_MAJOR, jpeg->vdev->minor); platform_set_drvdata(pdev, jpeg); @@ -1102,10 +1104,10 @@ static int mtk_jpeg_probe(struct platform_device *pdev) return 0; -err_dec_vdev_register: - video_device_release(jpeg->dec_vdev); +err_vfd_jpeg_register: + video_device_release(jpeg->vdev); -err_dec_vdev_alloc: +err_vfd_jpeg_alloc: v4l2_m2m_release(jpeg->m2m_dev); err_m2m_init: @@ -1125,8 +1127,8 @@ static int mtk_jpeg_remove(struct platform_device *pdev) struct mtk_jpeg_dev *jpeg = platform_get_drvdata(pdev); pm_runtime_disable(&pdev->dev); - video_unregister_device(jpeg->dec_vdev); - video_device_release(jpeg->dec_vdev); + video_unregister_device(jpeg->vdev); + video_device_release(jpeg->vdev); v4l2_m2m_release(jpeg->m2m_dev); v4l2_device_unregister(&jpeg->v4l2_dev); diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h index 5fcdf6950782..0b59e48495d5 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h @@ -51,8 +51,8 @@ enum mtk_jpeg_ctx_state { * @v4l2_dev: v4l2 device for mem2mem mode * @m2m_dev: v4l2 mem2mem device data * @alloc_ctx: videobuf2 memory allocator's context - * @dec_vdev: video device node for decoder mem2mem mode - * @dec_reg_base: JPEG registers mapping + * @vdev: video device node for jpeg mem2mem mode + * @reg_base: JPEG registers mapping * @clk_jdec: JPEG hw working clock * @clk_jdec_smi: JPEG SMI bus clock * @larb: SMI device @@ -65,8 +65,8 @@ struct mtk_jpeg_dev { struct v4l2_device v4l2_dev; struct v4l2_m2m_dev *m2m_dev; void *alloc_ctx; - struct video_device *dec_vdev; - void __iomem *dec_reg_base; + struct video_device *vdev; + void __iomem *reg_base; struct clk *clk_jdec; struct clk *clk_jdec_smi; struct device *larb; diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h index 1cc37dbfc8e7..ce263db5f30a 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h @@ -3,10 +3,11 @@ * Copyright (c) 2016 MediaTek Inc. * Author: Ming Hsiu Tsai * Rick Chang + * Xia Jiang */ -#ifndef _MTK_JPEG_HW_H -#define _MTK_JPEG_HW_H +#ifndef _MTK_JPEG_DEC_HW_H +#define _MTK_JPEG_DEC_HW_H #include @@ -75,4 +76,4 @@ void mtk_jpeg_dec_set_config(void __iomem *base, void mtk_jpeg_dec_reset(void __iomem *dec_reg_base); void mtk_jpeg_dec_start(void __iomem *dec_reg_base); -#endif /* _MTK_JPEG_HW_H */ +#endif /* _MTK_JPEG_DEC_HW_H */