From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: linux-input@vger.kernel.org,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Nick Dyer <nick@shmanahar.org>,
Lucas Stach <l.stach@pengutronix.de>,
Christopher Heiny <cheiny@synaptics.com>,
Vandana BN <bnvandana@gmail.com>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: [PATCH 2/5] input/rmi4/rmi_f54: fix various V4L2 compliance problems
Date: Tue, 19 Nov 2019 11:51:15 +0100 [thread overview]
Message-ID: <20191119105118.54285-3-hverkuil-cisco@xs4all.nl> (raw)
In-Reply-To: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl>
The v4l2-compliance utility reported several V4L2 API compliance
issues:
- the sequence counter wasn't filled in
- the sequence counter wasn't reset to 0 at the start of streaming
- the returned field value wasn't set to V4L2_FIELD_NONE
- the timestamp wasn't set
- the payload size was undefined if an error was returned
- min_buffers_needed doesn't need to be initialized
Fix these issues.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/input/rmi4/rmi_f54.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c
index 710b02595486..ebccab7a4834 100644
--- a/drivers/input/rmi4/rmi_f54.c
+++ b/drivers/input/rmi4/rmi_f54.c
@@ -116,6 +116,7 @@ struct f54_data {
struct video_device vdev;
struct vb2_queue queue;
struct mutex lock;
+ u32 sequence;
int input;
enum rmi_f54_report_type inputs[F54_MAX_REPORT_TYPE];
};
@@ -290,6 +291,7 @@ static int rmi_f54_queue_setup(struct vb2_queue *q, unsigned int *nbuffers,
static void rmi_f54_buffer_queue(struct vb2_buffer *vb)
{
+ struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
struct f54_data *f54 = vb2_get_drv_priv(vb->vb2_queue);
u16 *ptr;
enum vb2_buffer_state state;
@@ -298,6 +300,7 @@ static void rmi_f54_buffer_queue(struct vb2_buffer *vb)
mutex_lock(&f54->status_mutex);
+ vb2_set_plane_payload(vb, 0, 0);
reptype = rmi_f54_get_reptype(f54, f54->input);
if (reptype == F54_REPORT_NONE) {
state = VB2_BUF_STATE_ERROR;
@@ -344,14 +347,25 @@ static void rmi_f54_buffer_queue(struct vb2_buffer *vb)
data_done:
mutex_unlock(&f54->data_mutex);
done:
+ vb->timestamp = ktime_get_ns();
+ vbuf->field = V4L2_FIELD_NONE;
+ vbuf->sequence = f54->sequence++;
vb2_buffer_done(vb, state);
mutex_unlock(&f54->status_mutex);
}
+static void rmi_f54_stop_streaming(struct vb2_queue *q)
+{
+ struct f54_data *f54 = vb2_get_drv_priv(q);
+
+ f54->sequence = 0;
+}
+
/* V4L2 structures */
static const struct vb2_ops rmi_f54_queue_ops = {
.queue_setup = rmi_f54_queue_setup,
.buf_queue = rmi_f54_buffer_queue,
+ .stop_streaming = rmi_f54_stop_streaming,
.wait_prepare = vb2_ops_wait_prepare,
.wait_finish = vb2_ops_wait_finish,
};
@@ -363,7 +377,6 @@ static const struct vb2_queue rmi_f54_queue = {
.ops = &rmi_f54_queue_ops,
.mem_ops = &vb2_vmalloc_memops,
.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,
- .min_buffers_needed = 1,
};
static int rmi_f54_vidioc_querycap(struct file *file, void *priv,
--
2.23.0
next prev parent reply other threads:[~2019-11-19 10:51 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-19 10:51 [PATCH 0/5] input: rmi4/synaptics fixes Hans Verkuil
2019-11-19 10:51 ` [PATCH 1/5] input/mouse/synaptics: add LEN0091 support Hans Verkuil
2019-11-23 0:17 ` Dmitry Torokhov
2019-11-19 10:51 ` Hans Verkuil [this message]
2019-11-19 11:42 ` [PATCH 2/5] input/rmi4/rmi_f54: fix various V4L2 compliance problems Lucas Stach
2019-11-23 0:19 ` Dmitry Torokhov
2019-11-19 10:51 ` [PATCH 3/5] pixfmt-tch-td16/tu16.rst: document that this is little endian Hans Verkuil
2019-11-23 16:12 ` Hans Verkuil
2019-11-25 18:51 ` Dmitry Torokhov
2019-11-19 10:51 ` [PATCH 4/5] input/rmi4/rmi_driver: check if irq_find_mapping returns 0 Hans Verkuil
2019-11-19 11:38 ` Lucas Stach
2019-11-19 11:43 ` Hans Verkuil
2019-11-23 13:53 ` Hans Verkuil
2019-11-19 10:51 ` [PATCH 5/5] input/rmi4/rmi_smbus.c: don't increment rmiaddr in rmi_smb_read_block() Hans Verkuil
2019-11-19 11:48 ` Lucas Stach
2019-11-19 12:19 ` Hans Verkuil
2019-11-23 16:27 ` [PATCHv2 5/5] input/rmi4/rmi_smbus.c: don't increment rmiaddr Hans Verkuil
2019-12-02 18:09 ` Dmitry Torokhov
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=20191119105118.54285-3-hverkuil-cisco@xs4all.nl \
--to=hverkuil-cisco@xs4all.nl \
--cc=bnvandana@gmail.com \
--cc=cheiny@synaptics.com \
--cc=dmitry.torokhov@gmail.com \
--cc=l.stach@pengutronix.de \
--cc=linux-input@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=nick@shmanahar.org \
--cc=p.zabel@pengutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).