All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jammy Huang <jammy_huang@aspeedtech.com>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH v5 09/10] media: aspeed: add comments and macro
Date: Thu, 18 Nov 2021 15:40:30 +0800	[thread overview]
Message-ID: <20211118074030.685-10-jammy_huang@aspeedtech.com> (raw)
In-Reply-To: <20211118074030.685-1-jammy_huang@aspeedtech.com>

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 <jammy_huang@aspeedtech.com>
---
v5:
  - no update
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 419825ed7737..03bb6c46f2a1 100644
--- a/drivers/media/platform/aspeed-video.c
+++ b/drivers/media/platform/aspeed-video.c
@@ -33,6 +33,8 @@
 #include <linux/videodev2.h>
 #include <uapi/linux/aspeed-video.h>
 
+#define ASPEED_VIDEO_V4L2_MIN_BUF_REQ 3
+
 #define DEVICE_NAME			"aspeed-video"
 
 #define ASPEED_VIDEO_JPEG_NUM_QUALITIES	12
@@ -193,6 +195,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,
@@ -231,6 +242,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;
@@ -1305,7 +1338,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;
@@ -1322,7 +1355,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 /
@@ -1906,7 +1939,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


WARNING: multiple messages have this Message-ID (diff)
From: Jammy Huang <jammy_huang@aspeedtech.com>
To: <eajames@linux.ibm.com>, <mchehab@kernel.org>, <joel@jms.id.au>,
	<andrew@aj.id.au>, <hverkuil-cisco@xs4all.nl>,
	<sakari.ailus@linux.intel.com>, <gregkh@linuxfoundation.org>,
	<laurent.pinchart@ideasonboard.com>,
	<linux-media@vger.kernel.org>, <openbmc@lists.ozlabs.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v5 09/10] media: aspeed: add comments and macro
Date: Thu, 18 Nov 2021 15:40:30 +0800	[thread overview]
Message-ID: <20211118074030.685-10-jammy_huang@aspeedtech.com> (raw)
In-Reply-To: <20211118074030.685-1-jammy_huang@aspeedtech.com>

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 <jammy_huang@aspeedtech.com>
---
v5:
  - no update
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 419825ed7737..03bb6c46f2a1 100644
--- a/drivers/media/platform/aspeed-video.c
+++ b/drivers/media/platform/aspeed-video.c
@@ -33,6 +33,8 @@
 #include <linux/videodev2.h>
 #include <uapi/linux/aspeed-video.h>
 
+#define ASPEED_VIDEO_V4L2_MIN_BUF_REQ 3
+
 #define DEVICE_NAME			"aspeed-video"
 
 #define ASPEED_VIDEO_JPEG_NUM_QUALITIES	12
@@ -193,6 +195,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,
@@ -231,6 +242,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;
@@ -1305,7 +1338,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;
@@ -1322,7 +1355,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 /
@@ -1906,7 +1939,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


WARNING: multiple messages have this Message-ID (diff)
From: Jammy Huang <jammy_huang@aspeedtech.com>
To: <eajames@linux.ibm.com>, <mchehab@kernel.org>, <joel@jms.id.au>,
	<andrew@aj.id.au>, <hverkuil-cisco@xs4all.nl>,
	<sakari.ailus@linux.intel.com>, <gregkh@linuxfoundation.org>,
	<laurent.pinchart@ideasonboard.com>,
	<linux-media@vger.kernel.org>, <openbmc@lists.ozlabs.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v5 09/10] media: aspeed: add comments and macro
Date: Thu, 18 Nov 2021 15:40:30 +0800	[thread overview]
Message-ID: <20211118074030.685-10-jammy_huang@aspeedtech.com> (raw)
In-Reply-To: <20211118074030.685-1-jammy_huang@aspeedtech.com>

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 <jammy_huang@aspeedtech.com>
---
v5:
  - no update
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 419825ed7737..03bb6c46f2a1 100644
--- a/drivers/media/platform/aspeed-video.c
+++ b/drivers/media/platform/aspeed-video.c
@@ -33,6 +33,8 @@
 #include <linux/videodev2.h>
 #include <uapi/linux/aspeed-video.h>
 
+#define ASPEED_VIDEO_V4L2_MIN_BUF_REQ 3
+
 #define DEVICE_NAME			"aspeed-video"
 
 #define ASPEED_VIDEO_JPEG_NUM_QUALITIES	12
@@ -193,6 +195,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,
@@ -231,6 +242,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;
@@ -1305,7 +1338,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;
@@ -1322,7 +1355,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 /
@@ -1906,7 +1939,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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-11-18  7:40 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18  7:40 [PATCH v5 00/10] add aspeed-jpeg support for aspeed-video Jammy Huang
2021-11-18  7:40 ` Jammy Huang
2021-11-18  7:40 ` Jammy Huang
2021-11-18  7:40 ` [PATCH v5 01/10] media: aspeed: move err-handling together to the bottom Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40 ` [PATCH v5 02/10] media: aspeed: use v4l2_info/v4l2_warn/v4l2_dbg for log Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18 11:56   ` Sakari Ailus
2021-11-18 11:56     ` Sakari Ailus
2021-11-18 11:56     ` Sakari Ailus
2021-11-18 11:56     ` Sakari Ailus
2021-11-19  1:44     ` Jammy Huang
2021-11-19  1:44       ` Jammy Huang
2021-11-18  7:40 ` [PATCH v5 03/10] media: aspeed: add more debug log messages Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18 11:57   ` Sakari Ailus
2021-11-18 11:57     ` Sakari Ailus
2021-11-18 11:57     ` Sakari Ailus
2021-11-18 11:57     ` Sakari Ailus
2021-11-19  1:55     ` Jammy Huang
2021-11-19  1:55       ` Jammy Huang
2021-11-19  1:55       ` Jammy Huang
2021-11-19  1:55       ` Jammy Huang
2021-11-18  7:40 ` [PATCH v5 04/10] media: aspeed: refactor to gather format/compress settings Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40 ` [PATCH v5 05/10] media: v4l: Add definition for the Aspeed JPEG format Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18 12:33   ` Sakari Ailus
2021-11-18 12:33     ` Sakari Ailus
2021-11-18 12:33     ` Sakari Ailus
2021-11-18 12:33     ` Sakari Ailus
2021-11-19  2:02     ` Jammy Huang
2021-11-19  2:02       ` Jammy Huang
2021-11-19  2:02       ` Jammy Huang
2021-11-19  2:02       ` Jammy Huang
2021-11-19  8:39       ` Paul Menzel
2021-11-19  8:39         ` Paul Menzel
2021-11-19  8:39         ` Paul Menzel
2021-11-19  8:39         ` Paul Menzel
2021-11-19  9:37         ` Jammy Huang
2021-11-19  9:37           ` Jammy Huang
2021-11-19  9:37           ` Jammy Huang
2021-11-19  9:37           ` Jammy Huang
2021-11-23 10:23       ` Sakari Ailus
2021-11-23 10:23         ` Sakari Ailus
2021-11-23 10:23         ` Sakari Ailus
2021-11-23 10:23         ` Sakari Ailus
2021-11-26  8:08         ` Jammy Huang
2021-11-26  8:08           ` Jammy Huang
2021-11-26  8:08           ` Jammy Huang
2021-11-26  8:08           ` Jammy Huang
2021-11-18  7:40 ` [PATCH v5 06/10] media: v4l2-ctrls: Reserve controls for ASPEED Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40 ` [PATCH v5 07/10] media: aspeed: Use runtime configuration Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40 ` [PATCH v5 08/10] media: aspeed: Support aspeed mode to reduce compressed data Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-25 14:39   ` Hans Verkuil
2021-11-25 14:39     ` Hans Verkuil
2021-11-25 14:39     ` Hans Verkuil
2021-11-18  7:40 ` Jammy Huang [this message]
2021-11-18  7:40   ` [PATCH v5 09/10] media: aspeed: add comments and macro Jammy Huang
2021-11-18  7:40   ` Jammy Huang
2021-11-25 14:31 ` [PATCH v5 00/10] add aspeed-jpeg support for aspeed-video Hans Verkuil
2021-11-25 14:31   ` Hans Verkuil
2021-11-25 14:31   ` Hans Verkuil
2021-11-26  8:17   ` Jammy Huang
2021-11-26  8:17     ` Jammy Huang
2021-11-26  8:17     ` Jammy Huang
2021-11-26  9:51     ` Hans Verkuil
2021-11-26  9:51       ` Hans Verkuil
2021-11-26  9:51       ` Hans Verkuil
2021-12-02  1:29       ` Jammy Huang
2021-12-02  1:29         ` Jammy Huang
2021-12-02  1:29         ` Jammy Huang
2021-12-07  3:03         ` Jammy Huang
2021-12-07  3:03           ` Jammy Huang
2021-12-07  3:03           ` Jammy Huang
2021-12-20 19:55           ` sakari.ailus
2021-12-20 19:55             ` sakari.ailus
2021-12-20 19:55             ` sakari.ailus
2021-12-20 19:55             ` sakari.ailus
2021-12-21  2:13             ` Jammy Huang
2021-12-21  2:13               ` Jammy Huang
2021-12-21  2:13               ` Jammy Huang
2021-12-21  2:13               ` Jammy Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211118074030.685-10-jammy_huang@aspeedtech.com \
    --to=jammy_huang@aspeedtech.com \
    --cc=linux-aspeed@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.