From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1619C433EF for ; Mon, 15 Nov 2021 07:48:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88A2263211 for ; Mon, 15 Nov 2021 07:48:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236939AbhKOHve (ORCPT ); Mon, 15 Nov 2021 02:51:34 -0500 Received: from twspam01.aspeedtech.com ([211.20.114.71]:63151 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbhKOHsy (ORCPT ); Mon, 15 Nov 2021 02:48:54 -0500 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 1AF7KrAA080866; Mon, 15 Nov 2021 15:20:53 +0800 (GMT-8) (envelope-from jammy_huang@aspeedtech.com) Received: from JammyHuang-PC.aspeed.com (192.168.2.115) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 15 Nov 2021 15:44:28 +0800 From: Jammy Huang To: , , , , , , , , , , , , Subject: [PATCH v4 8/9] media: aspeed: add comments and macro Date: Mon, 15 Nov 2021 15:44:36 +0800 Message-ID: <20211115074437.28079-9-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211115074437.28079-1-jammy_huang@aspeedtech.com> References: <20211115074437.28079-1-jammy_huang@aspeedtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.2.115] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 1AF7KrAA080866 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add comments to describe video-stat and 'struct aspeed_video'. Add macro, ASPEED_VIDEO_V4L2_MIN_BUF_REQ, to describe the buffers needed. Signed-off-by: Jammy Huang --- v4: - update comments v3: - no update v2: - no update --- drivers/media/platform/aspeed-video.c | 39 ++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c index a13214e32454..00730bdda561 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -33,6 +33,8 @@ #include #include +#define ASPEED_VIDEO_V4L2_MIN_BUF_REQ 3 + #define DEVICE_NAME "aspeed-video" #define ASPEED_VIDEO_JPEG_NUM_QUALITIES 12 @@ -197,6 +199,15 @@ #define VE_MEM_RESTRICT_START 0x310 #define VE_MEM_RESTRICT_END 0x314 +/* + * @VIDEO_MODE_DETECT_DONE: a flag raised if signal lock + * @VIDEO_RES_CHANGE: a flag raised if res_change work on-going + * @VIDEO_RES_DETECT: a flag raised if res. detection on-going + * @VIDEO_STREAMING: a flag raised if user requires stream-on + * @VIDEO_FRAME_INPRG: a flag raised if hw working on a frame + * @VIDEO_STOPPED: a flag raised if device release + * @VIDEO_CLOCKS_ON: a flag raised if clk is on + */ enum { VIDEO_MODE_DETECT_DONE, VIDEO_RES_CHANGE, @@ -235,6 +246,28 @@ struct aspeed_video_perf { #define to_aspeed_video_buffer(x) \ container_of((x), struct aspeed_video_buffer, vb) +/** + * struct aspeed_video - driver data + * + * @flags: holds the state of video + * @sequence: holds the last number of frame completed + * @max_compressed_size:holds max compressed stream's size + * @srcs: holds the buffer information for srcs + * @jpeg: holds the buffer information for jpeg header + * @bcd: holds the buffer information for bcd work + * @yuv420: a flag raised if JPEG subsampling is 420 + * @format: holds the video format + * @hq_mode: a flag raised if HQ is enabled. Only for VIDEO_FMT_ASPEED + * @frame_rate: holds the frame_rate + * @jpeg_quality: holds jpeq's quality (0~11) + * @jpeg_hq_quality: holds hq's quality (0~11) only if hq_mode enabled + * @compression_mode: holds jpeg compression mode + * @frame_bottom: end position of video data in vertical direction + * @frame_left: start position of video data in horizontal direction + * @frame_right: end position of video data in horizontal direction + * @frame_top: start position of video data in vertical direction + * @perf: holds the statistics primary for debugfs + */ struct aspeed_video { void __iomem *base; struct clk *eclk; @@ -1276,7 +1309,7 @@ static int aspeed_video_get_parm(struct file *file, void *fh, struct aspeed_video *video = video_drvdata(file); a->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; - a->parm.capture.readbuffers = 3; + a->parm.capture.readbuffers = ASPEED_VIDEO_V4L2_MIN_BUF_REQ; a->parm.capture.timeperframe.numerator = 1; if (!video->frame_rate) a->parm.capture.timeperframe.denominator = MAX_FRAME_RATE; @@ -1293,7 +1326,7 @@ static int aspeed_video_set_parm(struct file *file, void *fh, struct aspeed_video *video = video_drvdata(file); a->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; - a->parm.capture.readbuffers = 3; + a->parm.capture.readbuffers = ASPEED_VIDEO_V4L2_MIN_BUF_REQ; if (a->parm.capture.timeperframe.numerator) frame_rate = a->parm.capture.timeperframe.denominator / @@ -1879,7 +1912,7 @@ static int aspeed_video_setup_video(struct aspeed_video *video) vbq->drv_priv = video; vbq->buf_struct_size = sizeof(struct aspeed_video_buffer); vbq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - vbq->min_buffers_needed = 3; + vbq->min_buffers_needed = ASPEED_VIDEO_V4L2_MIN_BUF_REQ; rc = vb2_queue_init(vbq); if (rc) { -- 2.25.1