[RFC/PATCH,v2] media: Add stk1160 new driver
Commit Message
Hi Ezequiel!
On Sat June 2 2012 17:37:28 Ezequiel Garcia wrote:
> On Sat, Jun 2, 2012 at 12:32 PM, Ezequiel Garcia <elezegarcia@gmail.com> wrote:
> > This driver adds support for stk1160 usb bridge as used in some
> > video/audio usb capture devices.
> > It is a complete rewrite of staging/media/easycap driver and
> > it's expected as a future replacement.
> >
> > Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
> > ---
> > As of today testing has been performed using both vlc and mplayer
> > on a gentoo machine, including hot unplug and on-the-fly standard
> > change using a device with 1-cvs and 1-audio output.
> > However more testing is underway with another device and/or another
> > distribution.
> >
> > Support for multiple input devices is a missing feature.
> > Alsa sound support is a missing feature. (I'm working on both)
> >
> > As this is my first complete driver,
> > the patch (obviously) intended as RFC only.
> > Any comments/reviews of *any* kind will be greatly appreciated.
> >
> > This new version tries to solve the issues pointed out by
> > Hans Verkuil and Sylwester Nawrocki (thanks to both!)
> >
> > Changes from v1:
> > * Use media control framework
> > * Register video device as the last thing
> > * Use v4l_device release to release all resources
> > * Add explicit locking for file operations
> > * Add vb2 buffer sanity check
> > * Minor style cleanups
> >
>
> I'm adding "v4l2-compliance -v 2 -d /dev/video1" output as requested by Hans.
Thanks. I've fixed several things reported by v4l2-compliance (see my patch
below), but you are using an older v4l2-compliance version. You should clone
and compile the v4l-utils.git repository yourself, rather than using a distro
provided version (which I think is what you are doing now).
Can you apply my patch on yours and run the latest v4l2-compliance again?
> Driver Info:
> Driver name : stk1160
> Card type : stk1160
> Bus info :
> Driver version: 3.4.0
> Capabilities : 0x05000001
> Video Capture
> Read/Write
> Streaming
>
> Compliance test for device /dev/video1 (not using libv4l2):
>
> Required ioctls:
> fail: v4l2-compliance.cpp(217): string empty
> warn: VIDIOC_QUERYCAP: empty bus_info
> test VIDIOC_QUERYCAP: OK
>
> Allow for multiple opens:
> test second video open: OK
> fail: v4l2-compliance.cpp(217): string empty
> warn: VIDIOC_QUERYCAP: empty bus_info
> test VIDIOC_QUERYCAP: OK
> fail: v4l2-compliance.cpp(273): doioctl(node, VIDIOC_G_PRIORITY, &prio)
> test VIDIOC_G/S_PRIORITY: FAIL
>
> Debug ioctls:
> test VIDIOC_DBG_G_CHIP_IDENT: FAIL
> fail: v4l2-test-debug.cpp(82): uid == 0 && ret
> test VIDIOC_DBG_G/S_REGISTER: FAIL
> test VIDIOC_LOG_STATUS: FAIL
>
> Input ioctls:
> fail: v4l2-test-input-output.cpp(133): couldn't get tuner 0
> test VIDIOC_G/S_TUNER: FAIL
> fail: v4l2-test-input-output.cpp(228): could get frequency for invalid tuner 0
> test VIDIOC_G/S_FREQUENCY: FAIL
> fail: v4l2-test-input-output.cpp(358): could not enumerate audio input 0
> test VIDIOC_ENUMAUDIO: FAIL
> test VIDIOC_G/S/ENUMINPUT: OK
> fail: v4l2-test-input-output.cpp(377): No audio inputs, but G_AUDIO
> did not return EINVAL
> fail: v4l2-test-input-output.cpp(421): invalid audioset for input 0
> test VIDIOC_G/S_AUDIO: FAIL
> Inputs: 1 Audio Inputs: 0 Tuners: 0
>
> Output ioctls:
> fail: v4l2-test-input-output.cpp(479): couldn't get modulator 0
> test VIDIOC_G/S_MODULATOR: FAIL
> fail: v4l2-test-input-output.cpp(563): could get frequency for
> invalid modulator 0
> test VIDIOC_G/S_FREQUENCY: FAIL
> fail: v4l2-test-input-output.cpp(682): could not enumerate audio output 0
> test VIDIOC_ENUMAUDOUT: FAIL
> test VIDIOC_G/S/ENUMOUTPUT: FAIL
> test VIDIOC_G/S_AUDOUT: Not Supported
> Outputs: 0 Audio Outputs: 0 Modulators: 0
>
> Control ioctls:
> info: checking v4l2_queryctrl of control 'User Controls' (0x00980001)
> info: checking v4l2_queryctrl of control 'Brightness' (0x00980900)
> info: checking v4l2_queryctrl of control 'Contrast' (0x00980901)
> info: checking v4l2_queryctrl of control 'Saturation' (0x00980902)
> info: checking v4l2_queryctrl of control 'Hue' (0x00980903)
> info: checking v4l2_queryctrl of control 'Chroma AGC' (0x0098091d)
> info: checking v4l2_queryctrl of control 'Chroma Gain' (0x00980924)
> info: checking v4l2_queryctrl of control 'Brightness' (0x00980900)
> info: checking v4l2_queryctrl of control 'Contrast' (0x00980901)
> info: checking v4l2_queryctrl of control 'Saturation' (0x00980902)
> info: checking v4l2_queryctrl of control 'Hue' (0x00980903)
> info: checking v4l2_queryctrl of control 'Chroma AGC' (0x0098091d)
> info: checking v4l2_queryctrl of control 'Chroma Gain' (0x00980924)
> test VIDIOC_QUERYCTRL/MENU: OK
> info: checking control 'User Controls' (0x00980001)
> info: checking control 'Brightness' (0x00980900)
> info: checking control 'Contrast' (0x00980901)
> info: checking control 'Saturation' (0x00980902)
> info: checking control 'Hue' (0x00980903)
> info: checking control 'Chroma AGC' (0x0098091d)
> info: checking control 'Chroma Gain' (0x00980924)
> test VIDIOC_G/S_CTRL: OK
> info: checking extended control 'User Controls' (0x00980001)
> info: checking extended control 'Brightness' (0x00980900)
> info: checking extended control 'Contrast' (0x00980901)
> info: checking extended control 'Saturation' (0x00980902)
> info: checking extended control 'Hue' (0x00980903)
> info: checking extended control 'Chroma AGC' (0x0098091d)
> info: checking extended control 'Chroma Gain' (0x00980924)
> test VIDIOC_G/S/TRY_EXT_CTRLS: OK
> Standard Controls: 7 Private Controls: 0
>
> Input/Output configuration ioctls:
> test VIDIOC_ENUM/G/S/QUERY_STD: OK
> fail: v4l2-test-io-config.cpp(167): could set preset V4L2_DV_INVALID
> fail: v4l2-test-io-config.cpp(216): Presets failed for input 0.
> test VIDIOC_ENUM/G/S/QUERY_DV_PRESETS: FAIL
> test VIDIOC_G/S_DV_TIMINGS: Not Supported
>
> Format ioctls:
> info: found 1 formats for buftype 1
> test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
> fail: v4l2-test-formats.cpp(327): expected EINVAL, but got 25 when
> getting framebuffer format
> test VIDIOC_G_FBUF: FAIL
> fail: v4l2-test-formats.cpp(481): Video Capture Multiplanar cap set,
> but no Video Capture Multiplanar formats defined
> test VIDIOC_G_FMT: FAIL
> fail: v4l2-test-formats.cpp(509): ret && ret != EINVAL && sliced_type
> test VIDIOC_G_SLICED_VBI_CAP: FAIL
> Total: 27 Succeeded: 11 Failed: 16 Warnings: 2
>
Below is my (untested) patch that should fix a number of things.
BTW, I hate the use of current_norm, and in fact I plan to get rid of current_norm
in the near future. So that's why I replaced it with g_std.
Regards,
Hans
Date: Sun, 3 Jun 2012 12:27:57 +0200
Subject: [PATCH] stk1160: add prio & control event support. Fix querycap.
Also add g_std instead of using current_norm.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
drivers/media/video/stk1160/stk1160-core.c | 2 +-
drivers/media/video/stk1160/stk1160-v4l.c | 40 +++++++++++++++++++---------
drivers/media/video/stk1160/stk1160.h | 1 +
3 files changed, 30 insertions(+), 13 deletions(-)
Comments
Hi Hans,
On Sun, Jun 3, 2012 at 7:33 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
[snip]
> Thanks. I've fixed several things reported by v4l2-compliance (see my patch
> below), but you are using an older v4l2-compliance version. You should clone
> and compile the v4l-utils.git repository yourself, rather than using a distro
> provided version (which I think is what you are doing now).
>
> Can you apply my patch on yours and run the latest v4l2-compliance again?
Okey I'll do that, and send you the results.
>
> Below is my (untested) patch that should fix a number of things.
>
> BTW, I hate the use of current_norm, and in fact I plan to get rid of current_norm
> in the near future. So that's why I replaced it with g_std.
Okey. I wasn't aware of that. I just saw it somewhere and I assumed it
was *the right thing*.
Thanks for your help :)
See ya,
Ezequiel.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hans,
On Sun, Jun 3, 2012 at 7:33 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
>
> Thanks. I've fixed several things reported by v4l2-compliance (see my patch
> below), but you are using an older v4l2-compliance version. You should clone
> and compile the v4l-utils.git repository yourself, rather than using a distro
> provided version (which I think is what you are doing now).
>
> Can you apply my patch on yours and run the latest v4l2-compliance again?
I applied your patch, updated v4l2-compliance and here is the output:
---
$ v4l2-compliance -d /dev/video1
Driver Info:
Driver name : stk1160
Card type : stk1160
Bus info : usb-0000:00:13.2-1
Driver version: 3.4.0
Capabilities : 0x85000001
Video Capture
Read/Write
Streaming
Device Capabilities
Device Caps : 0x05000001
Video Capture
Read/Write
Streaming
Compliance test for device /dev/video1 (not using libv4l2):
Required ioctls:
test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
Debug ioctls:
test VIDIOC_DBG_G_CHIP_IDENT: Not Supported
test VIDIOC_DBG_G/S_REGISTER: Not Supported
test VIDIOC_LOG_STATUS: OK
Input ioctls:
test VIDIOC_G/S_TUNER: Not Supported
test VIDIOC_G/S_FREQUENCY: Not Supported
test VIDIOC_S_HW_FREQ_SEEK: Not Supported
test VIDIOC_ENUMAUDIO: Not Supported
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: Not Supported
Inputs: 1 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: Not Supported
test VIDIOC_G/S_FREQUENCY: Not Supported
test VIDIOC_ENUMAUDOUT: Not Supported
test VIDIOC_G/S/ENUMOUTPUT: Not Supported
test VIDIOC_G/S_AUDOUT: Not Supported
Outputs: 0 Audio Outputs: 0 Modulators: 0
Control ioctls:
test VIDIOC_QUERYCTRL/MENU: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: Not Supported
Standard Controls: 7 Private Controls: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK
test VIDIOC_ENUM/G/S/QUERY_DV_PRESETS: Not Supported
test VIDIOC_G/S_DV_TIMINGS: Not Supported
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: Not Supported
test VIDIOC_G_FBUF: Not Supported
test VIDIOC_G_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: Not Supported
Total: 31 Succeeded: 31 Failed: 0 Warnings: 0
---
None failed! :-)
Would you care to explain me this change in your patch?
+ set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags);
I guess I can consider the video part as working (at least with a
basic set of features).
I'll be working on alsa and support for several inputs now.
Thanks for reviewing!
Ezequiel.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sun June 3 2012 23:44:03 Ezequiel Garcia wrote:
> Hans,
>
> On Sun, Jun 3, 2012 at 7:33 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> >
> > Thanks. I've fixed several things reported by v4l2-compliance (see my patch
> > below), but you are using an older v4l2-compliance version. You should clone
> > and compile the v4l-utils.git repository yourself, rather than using a distro
> > provided version (which I think is what you are doing now).
> >
> > Can you apply my patch on yours and run the latest v4l2-compliance again?
>
> I applied your patch, updated v4l2-compliance and here is the output:
>
> ---
> $ v4l2-compliance -d /dev/video1
> Driver Info:
> Driver name : stk1160
> Card type : stk1160
> Bus info : usb-0000:00:13.2-1
> Driver version: 3.4.0
> Capabilities : 0x85000001
> Video Capture
> Read/Write
> Streaming
> Device Capabilities
> Device Caps : 0x05000001
> Video Capture
> Read/Write
> Streaming
>
> Compliance test for device /dev/video1 (not using libv4l2):
>
> Required ioctls:
> test VIDIOC_QUERYCAP: OK
>
> Allow for multiple opens:
> test second video open: OK
> test VIDIOC_QUERYCAP: OK
> test VIDIOC_G/S_PRIORITY: OK
>
> Debug ioctls:
> test VIDIOC_DBG_G_CHIP_IDENT: Not Supported
> test VIDIOC_DBG_G/S_REGISTER: Not Supported
> test VIDIOC_LOG_STATUS: OK
>
> Input ioctls:
> test VIDIOC_G/S_TUNER: Not Supported
> test VIDIOC_G/S_FREQUENCY: Not Supported
> test VIDIOC_S_HW_FREQ_SEEK: Not Supported
> test VIDIOC_ENUMAUDIO: Not Supported
> test VIDIOC_G/S/ENUMINPUT: OK
> test VIDIOC_G/S_AUDIO: Not Supported
> Inputs: 1 Audio Inputs: 0 Tuners: 0
>
> Output ioctls:
> test VIDIOC_G/S_MODULATOR: Not Supported
> test VIDIOC_G/S_FREQUENCY: Not Supported
> test VIDIOC_ENUMAUDOUT: Not Supported
> test VIDIOC_G/S/ENUMOUTPUT: Not Supported
> test VIDIOC_G/S_AUDOUT: Not Supported
> Outputs: 0 Audio Outputs: 0 Modulators: 0
>
> Control ioctls:
> test VIDIOC_QUERYCTRL/MENU: OK
> test VIDIOC_G/S_CTRL: OK
> test VIDIOC_G/S/TRY_EXT_CTRLS: OK
> test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
> test VIDIOC_G/S_JPEGCOMP: Not Supported
> Standard Controls: 7 Private Controls: 0
>
> Input/Output configuration ioctls:
> test VIDIOC_ENUM/G/S/QUERY_STD: OK
> test VIDIOC_ENUM/G/S/QUERY_DV_PRESETS: Not Supported
> test VIDIOC_G/S_DV_TIMINGS: Not Supported
>
> Format ioctls:
> test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
> test VIDIOC_G/S_PARM: Not Supported
> test VIDIOC_G_FBUF: Not Supported
> test VIDIOC_G_FMT: OK
> test VIDIOC_G_SLICED_VBI_CAP: Not Supported
> Total: 31 Succeeded: 31 Failed: 0 Warnings: 0
> ---
>
> None failed! :-)
Nice!
> Would you care to explain me this change in your patch?
> + set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags);
See Documentation/video4linux/v4l2-framework.txt:
"flags: optional. Set to V4L2_FL_USE_FH_PRIO if you want to let the framework
handle the VIDIOC_G/S_PRIORITY ioctls. This requires that you use struct
v4l2_fh. Eventually this flag will disappear once all drivers use the core
priority handling. But for now it has to be set explicitly."
Regards,
Hans
>
> I guess I can consider the video part as working (at least with a
> basic set of features).
> I'll be working on alsa and support for several inputs now.
>
> Thanks for reviewing!
> Ezequiel.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jun 4, 2012 at 5:47 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
>
>> Would you care to explain me this change in your patch?
>> + set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags);
>
> See Documentation/video4linux/v4l2-framework.txt:
>
> "flags: optional. Set to V4L2_FL_USE_FH_PRIO if you want to let the framework
> handle the VIDIOC_G/S_PRIORITY ioctls. This requires that you use struct
> v4l2_fh. Eventually this flag will disappear once all drivers use the core
> priority handling. But for now it has to be set explicitly."
>
So, by using v4l2_fh and setting V4L2_FL_USE_FH_PRIO, I can have
{g,s}_priority ioctls for free, right?
As far as I can see __video_do_ioctl checks if the ioctl is possible, like this:
520 if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) {
521 vfh = file->private_data;
522 use_fh_prio = test_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags);
523 }
524
525 if (use_fh_prio)
526 ret_prio = v4l2_prio_check(vfd->prio, vfh->prio);
Just checking,
Thanks!
Ezequiel.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon June 4 2012 21:50:46 Ezequiel Garcia wrote:
> On Mon, Jun 4, 2012 at 5:47 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> >
> >> Would you care to explain me this change in your patch?
> >> + set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags);
> >
> > See Documentation/video4linux/v4l2-framework.txt:
> >
> > "flags: optional. Set to V4L2_FL_USE_FH_PRIO if you want to let the framework
> > handle the VIDIOC_G/S_PRIORITY ioctls. This requires that you use struct
> > v4l2_fh. Eventually this flag will disappear once all drivers use the core
> > priority handling. But for now it has to be set explicitly."
> >
>
> So, by using v4l2_fh and setting V4L2_FL_USE_FH_PRIO, I can have
> {g,s}_priority ioctls for free, right?
Yes.
> As far as I can see __video_do_ioctl checks if the ioctl is possible, like this:
>
> 520 if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) {
> 521 vfh = file->private_data;
> 522 use_fh_prio = test_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags);
> 523 }
> 524
> 525 if (use_fh_prio)
> 526 ret_prio = v4l2_prio_check(vfd->prio, vfh->prio);
And V4L2_FL_USES_V4L2_FH is set by v4l2_fh_init() (called by v4l2_fh_open()).
Regards,
Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
@@ -189,7 +189,7 @@ static void stk1160_release(struct v4l2_device *v4l2_dev)
static int stk1160_scan_usb(struct usb_interface *intf, struct usb_device *udev,
unsigned int *max_pkt_size)
{
- int i, e, sizedescr, size, ifnum, inputnum;
+ int i, e, sizedescr, size, ifnum, inputnum = 1;
const struct usb_endpoint_descriptor *desc;
bool has_video = false, has_audio = false;
@@ -30,6 +30,7 @@
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-fh.h>
+#include <media/v4l2-event.h>
#include <media/videobuf2-vmalloc.h>
#include <media/saa7115.h>
@@ -93,11 +94,11 @@ static void stk1160_set_std(struct stk1160 *dev)
{0xffff, 0xffff}
};
- if (dev->vdev.current_norm & V4L2_STD_525_60) {
+ if (dev->norm & V4L2_STD_525_60) {
stk1160_dbg("registers to NTSC like standard\n");
for (i = 0; std525[i].reg != 0xffff; i++)
stk1160_write_reg(dev, std525[i].reg, std525[i].val);
- } else if (dev->vdev.current_norm & V4L2_STD_625_50) {
+ } else if (dev->norm & V4L2_STD_625_50) {
stk1160_dbg("registers to PAL like standard\n");
for (i = 0; std625[i].reg != 0xffff; i++)
stk1160_write_reg(dev, std625[i].reg, std625[i].val);
@@ -430,12 +431,16 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
static int vidioc_querycap(struct file *file,
void *priv, struct v4l2_capability *cap)
{
+ struct stk1160 *dev = video_drvdata(file);
+
strcpy(cap->driver, "stk1160");
strcpy(cap->card, "stk1160");
- cap->capabilities =
+ usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
+ cap->device_caps =
V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_STREAMING |
V4L2_CAP_READWRITE;
+ cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0;
}
@@ -523,6 +528,14 @@ static int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *norm)
return 0;
}
+static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
+{
+ struct stk1160 *dev = video_drvdata(file);
+
+ *norm = dev->norm;
+ return 0;
+}
+
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
{
struct stk1160 *dev = video_drvdata(file);
@@ -541,10 +554,10 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
return -ENODEV;
/* This is taken from saa7115 video decoder */
- if (dev->vdev.current_norm & V4L2_STD_525_60) {
+ if (dev->norm & V4L2_STD_525_60) {
dev->width = 720;
dev->height = 480;
- } else if (dev->vdev.current_norm & V4L2_STD_625_50) {
+ } else if (dev->norm & V4L2_STD_625_50) {
dev->width = 720;
dev->height = 576;
} else {
@@ -553,12 +566,12 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
}
/* We need to set this now, before we call stk1160_set_std */
- dev->vdev.current_norm = *norm;
+ dev->norm = *norm;
stk1160_set_std(dev);
v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std,
- dev->vdev.current_norm);
+ dev->norm);
return 0;
}
@@ -647,7 +660,7 @@ static const struct v4l2_ioctl_ops stk1160_ioctl_ops = {
.vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap,
.vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
.vidioc_querystd = vidioc_querystd,
- .vidioc_g_std = NULL, /* don't worry v4l handles this */
+ .vidioc_g_std = vidioc_g_std,
.vidioc_s_std = vidioc_s_std,
.vidioc_enum_input = vidioc_enum_input,
.vidioc_g_input = vidioc_g_input,
@@ -664,6 +677,9 @@ static const struct v4l2_ioctl_ops stk1160_ioctl_ops = {
.vidioc_streamoff = vidioc_streamoff,
/* TODO: Add debug ioctls: s/g_register, log_status, etc */
+ .vidioc_log_status = v4l2_ctrl_log_status,
+ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
+ .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
};
/********************************************************************/
@@ -824,10 +840,10 @@ int stk1160_video_register(struct stk1160 *dev)
/* This will be used to set video_device parent */
dev->vdev.v4l2_dev = &dev->v4l2_dev;
+ set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags);
- /* NTSC is default. Could be any other, but has to match
- * with video_device current_norm field */
- dev->vdev.current_norm = V4L2_STD_NTSC_M;
+ /* NTSC is default */
+ dev->norm = V4L2_STD_NTSC_M;
dev->width = 720;
dev->height = 480;
@@ -836,7 +852,7 @@ int stk1160_video_register(struct stk1160 *dev)
stk1160_set_std(dev);
v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std,
- dev->vdev.current_norm);
+ dev->norm);
video_set_drvdata(&dev->vdev, dev);
rc = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1);
@@ -141,6 +141,7 @@ struct stk1160 {
int width; /* current frame width */
int height; /* current frame height */
unsigned int ctl_input; /* selected input */
+ v4l2_std_id norm; /* current norm */
struct stk1160_fmt *fmt; /* selected format */
unsigned int field_count; /* not sure ??? */