From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: [PATCHv2 19/19] staging: media: av7110: fix VBI output support
Date: Thu, 23 Mar 2023 16:53:43 +0100 [thread overview]
Message-ID: <20230323155343.2399473-20-hverkuil-cisco@xs4all.nl> (raw)
In-Reply-To: <20230323155343.2399473-1-hverkuil-cisco@xs4all.nl>
With these changes it now passes the v4l2-compliance test.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/staging/media/av7110/av7110_v4l.c | 81 +++++++++++++++++------
1 file changed, 61 insertions(+), 20 deletions(-)
diff --git a/drivers/staging/media/av7110/av7110_v4l.c b/drivers/staging/media/av7110/av7110_v4l.c
index 3ab930cd8a27..6519bfa9fa1d 100644
--- a/drivers/staging/media/av7110/av7110_v4l.c
+++ b/drivers/staging/media/av7110/av7110_v4l.c
@@ -473,6 +473,28 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input)
return av7110_dvb_c_switch(dev);
}
+static int vidioc_enum_output(struct file *file, void *fh, struct v4l2_output *o)
+{
+ if (o->index)
+ return -EINVAL;
+ strscpy(o->name, "Video Output", sizeof(o->name));
+ o->type = V4L2_OUTPUT_TYPE_ANALOG;
+ o->std = V4L2_STD_NTSC_M | V4L2_STD_PAL_BG;
+ o->capabilities = V4L2_OUT_CAP_STD;
+ return 0;
+}
+
+static int vidioc_g_output(struct file *file, void *fh, unsigned int *output)
+{
+ *output = 0;
+ return 0;
+}
+
+static int vidioc_s_output(struct file *file, void *fh, unsigned int output)
+{
+ return output ? -EINVAL : 0;
+}
+
static int vidioc_enumaudio(struct file *file, void *fh, struct v4l2_audio *a)
{
dprintk(2, "VIDIOC_G_AUDIO: %d\n", a->index);
@@ -536,8 +558,29 @@ static int vidioc_g_fmt_sliced_vbi_out(struct file *file, void *fh,
if (av7110->wssMode) {
f->fmt.sliced.service_set = V4L2_SLICED_WSS_625;
f->fmt.sliced.service_lines[0][23] = V4L2_SLICED_WSS_625;
- f->fmt.sliced.io_size = sizeof(struct v4l2_sliced_vbi_data);
}
+ f->fmt.sliced.io_size = sizeof(struct v4l2_sliced_vbi_data);
+ return 0;
+}
+
+static int vidioc_try_fmt_sliced_vbi_out(struct file *file, void *fh,
+ struct v4l2_format *f)
+{
+ struct saa7146_dev *dev = video_drvdata(file);
+ struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
+ bool want_wss = (f->fmt.sliced.service_set & V4L2_SLICED_WSS_625) ||
+ (!f->fmt.sliced.service_set &&
+ f->fmt.sliced.service_lines[0][23] == V4L2_SLICED_WSS_625);
+
+ dprintk(2, "VIDIOC_G_FMT:\n");
+ if (FW_VERSION(av7110->arm_app) < 0x2623)
+ return -EINVAL;
+ memset(&f->fmt.sliced, 0, sizeof f->fmt.sliced);
+ if (want_wss) {
+ f->fmt.sliced.service_set = V4L2_SLICED_WSS_625;
+ f->fmt.sliced.service_lines[0][23] = V4L2_SLICED_WSS_625;
+ }
+ f->fmt.sliced.io_size = sizeof(struct v4l2_sliced_vbi_data);
return 0;
}
@@ -548,24 +591,18 @@ static int vidioc_s_fmt_sliced_vbi_out(struct file *file, void *fh,
struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
dprintk(2, "VIDIOC_S_FMT\n");
- if (FW_VERSION(av7110->arm_app) < 0x2623)
+ if (vidioc_try_fmt_sliced_vbi_out(file, fh, f))
return -EINVAL;
- if (f->fmt.sliced.service_set != V4L2_SLICED_WSS_625 &&
- f->fmt.sliced.service_lines[0][23] != V4L2_SLICED_WSS_625) {
- memset(&f->fmt.sliced, 0, sizeof(f->fmt.sliced));
+ if (f->fmt.sliced.service_set & V4L2_SLICED_WSS_625) {
+ /* WSS controlled by userspace */
+ av7110->wssMode = 1;
+ av7110->wssData = 0;
+ } else {
/* WSS controlled by firmware */
av7110->wssMode = 0;
av7110->wssData = 0;
return av7110_fw_cmd(av7110, COMTYPE_ENCODER,
SetWSSConfig, 1, 0);
- } else {
- memset(&f->fmt.sliced, 0, sizeof(f->fmt.sliced));
- f->fmt.sliced.service_set = V4L2_SLICED_WSS_625;
- f->fmt.sliced.service_lines[0][23] = V4L2_SLICED_WSS_625;
- f->fmt.sliced.io_size = sizeof(struct v4l2_sliced_vbi_data);
- /* WSS controlled by userspace */
- av7110->wssMode = 1;
- av7110->wssData = 0;
}
return 0;
}
@@ -575,6 +612,7 @@ static int av7110_vbi_reset(struct file *file)
struct saa7146_dev *dev = video_drvdata(file);
struct av7110 *av7110 = (struct av7110*) dev->ext_priv;
+ return 0;
dprintk(2, "%s\n", __func__);
av7110->wssMode = 0;
av7110->wssData = 0;
@@ -801,13 +839,16 @@ int av7110_init_v4l(struct av7110 *av7110)
vv_data->vid_ops.vidioc_s_audio = vidioc_s_audio;
vv_data->vid_ops.vidioc_g_fmt_vbi_cap = NULL;
- vv_data->vbi_ops.vidioc_g_tuner = vidioc_g_tuner;
- vv_data->vbi_ops.vidioc_s_tuner = vidioc_s_tuner;
- vv_data->vbi_ops.vidioc_g_frequency = vidioc_g_frequency;
- vv_data->vbi_ops.vidioc_s_frequency = vidioc_s_frequency;
+ vv_data->vbi_ops.vidioc_enum_output = vidioc_enum_output;
+ vv_data->vbi_ops.vidioc_g_output = vidioc_g_output;
+ vv_data->vbi_ops.vidioc_s_output = vidioc_s_output;
+ vv_data->vbi_ops.vidioc_g_parm = NULL;
vv_data->vbi_ops.vidioc_g_fmt_vbi_cap = NULL;
+ vv_data->vbi_ops.vidioc_try_fmt_vbi_cap = NULL;
+ vv_data->vbi_ops.vidioc_s_fmt_vbi_cap = NULL;
vv_data->vbi_ops.vidioc_g_sliced_vbi_cap = vidioc_g_sliced_vbi_cap;
vv_data->vbi_ops.vidioc_g_fmt_sliced_vbi_out = vidioc_g_fmt_sliced_vbi_out;
+ vv_data->vbi_ops.vidioc_try_fmt_sliced_vbi_out = vidioc_try_fmt_sliced_vbi_out;
vv_data->vbi_ops.vidioc_s_fmt_sliced_vbi_out = vidioc_s_fmt_sliced_vbi_out;
if (FW_VERSION(av7110->arm_app) < 0x2623)
@@ -848,7 +889,7 @@ static struct saa7146_standard standard[] = {
.h_offset = 0x48, .h_pixels = 708,
.v_max_out = 576, .h_max_out = 768,
}, {
- .name = "NTSC", .id = V4L2_STD_NTSC,
+ .name = "NTSC", .id = V4L2_STD_NTSC_M,
.v_offset = 0x10, .v_field = 244,
.h_offset = 0x40, .h_pixels = 708,
.v_max_out = 480, .h_max_out = 640,
@@ -862,7 +903,7 @@ static struct saa7146_standard analog_standard[] = {
.h_offset = 0x08, .h_pixels = 708,
.v_max_out = 576, .h_max_out = 768,
}, {
- .name = "NTSC", .id = V4L2_STD_NTSC,
+ .name = "NTSC", .id = V4L2_STD_NTSC_M,
.v_offset = 0x10, .v_field = 244,
.h_offset = 0x40, .h_pixels = 708,
.v_max_out = 480, .h_max_out = 640,
@@ -876,7 +917,7 @@ static struct saa7146_standard dvb_standard[] = {
.h_offset = 0x48, .h_pixels = 708,
.v_max_out = 576, .h_max_out = 768,
}, {
- .name = "NTSC", .id = V4L2_STD_NTSC,
+ .name = "NTSC", .id = V4L2_STD_NTSC_M,
.v_offset = 0x10, .v_field = 244,
.h_offset = 0x40, .h_pixels = 708,
.v_max_out = 480, .h_max_out = 640,
--
2.39.2
next prev parent reply other threads:[~2023-03-23 15:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 15:53 [PATCHv2 00/19] saa7146: convert to vb2 Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 01/19] media: common: saa7146: disable clipping Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 02/19] common/saa7146: fix VFL direction for vbi output Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 03/19] media: pci: saa7146: hexium_orion: initialize input 0 Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 04/19] media: saa7146: drop 'dev' and 'resources' from struct saa7146_fh Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 05/19] media: common: saa7146: drop 'fmt' from struct saa7146_buf Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 06/19] media: common: saa7146: replace BUG_ON by WARN_ON Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 07/19] staging: media: av7110: " Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 08/19] media: common: saa7146: fix broken V4L2_PIX_FMT_YUV422P support Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 09/19] media: common: saa7146: use for_each_sg_dma_page Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 10/19] media: saa7146: convert to vb2 Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 11/19] media: common: saa7146: fix compliance problems with field handling Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 12/19] media: common: saa7146: check minimum video format size Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 13/19] media: common: saa7146: fall back to V4L2_PIX_FMT_BGR24 Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 14/19] media: common: saa7146: allow S_STD(G_STD) Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 15/19] media: mxb: update the tvnorms when changing input Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 16/19] media: common: saa7146: add support for missing .vidioc_try_fmt_vbi_cap Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 17/19] media: mxb: allow tuner/input/audio ioctls for vbi Hans Verkuil
2023-03-23 15:53 ` [PATCHv2 18/19] media: pci: saa7146: advertise only those TV standard that are supported Hans Verkuil
2023-03-23 15:53 ` Hans Verkuil [this message]
2023-03-23 17:23 ` [PATCHv2 00/19] saa7146: convert to vb2 Hans Verkuil
2023-03-24 10:18 ` Hans Verkuil
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=20230323155343.2399473-20-hverkuil-cisco@xs4all.nl \
--to=hverkuil-cisco@xs4all.nl \
--cc=linux-media@vger.kernel.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 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).