Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
n9: fix for v4l2 event needed by libomap3camd
Nokia binary blob libomap3camd is expecting to receive
V4L2_EVENT_OMAP3ISP_HS_VS from OMAP3ISP CCDC. Also v4l2_event ABI
changed between kernels so patch includes fix for that.

Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
  • Loading branch information
filippz committed Jun 1, 2014
1 parent 0bf67d8 commit be54e27
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/media/video/omap3isp/ispccdc.c
Expand Up @@ -1408,11 +1408,13 @@ static int __ccdc_handle_stopping(struct isp_ccdc_device *ccdc, u32 event)
return rval;
}

#define V4L2_EVENT_OMAP3ISP_HS_VS_NOKIA (V4L2_EVENT_OMAP3ISP_CLASS | 0x4)
static void ccdc_hs_vs_isr(struct isp_ccdc_device *ccdc)
{
struct isp_pipeline *pipe = to_isp_pipeline(&ccdc->subdev.entity);
struct video_device *vdev = ccdc->subdev.devnode;
struct v4l2_event event;
struct v4l2_event event_Nokia;

/* Frame number propagation */
atomic_inc(&pipe->frame_number);
Expand All @@ -1422,6 +1424,11 @@ static void ccdc_hs_vs_isr(struct isp_ccdc_device *ccdc)
event.u.frame_sync.frame_sequence = atomic_read(&pipe->frame_number);

v4l2_event_queue(vdev, &event);

memset(&event_Nokia, 0, sizeof(event_Nokia));
event_Nokia.type = V4L2_EVENT_OMAP3ISP_HS_VS_NOKIA;

v4l2_event_queue(vdev, &event_Nokia);
}

/*
Expand Down Expand Up @@ -1700,7 +1707,6 @@ static long ccdc_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
return ret;
}

#define V4L2_EVENT_OMAP3ISP_HS_VS_NOKIA (V4L2_EVENT_OMAP3ISP_CLASS | 0x4)
static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
struct v4l2_event_subscription *sub)
{
Expand Down
24 changes: 24 additions & 0 deletions drivers/media/video/v4l2-subdev.c
Expand Up @@ -134,6 +134,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
struct v4l2_subdev_fh *subdev_fh = to_v4l2_subdev_fh(vfh);
#endif
struct v4l2_event ev;
struct v4l2_event_Nokia *evN;
long ret = 0;

switch (cmd) {
case VIDIOC_QUERYCTRL:
Expand Down Expand Up @@ -163,6 +166,27 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)

return v4l2_event_dequeue(vfh, arg, file->f_flags & O_NONBLOCK);

case VIDIOC_DQEVENT_NOKIA:
if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS))
return -ENOIOCTLCMD;

evN = arg;
memset(&ev, 0, sizeof(ev));

ret = v4l2_event_dequeue(vfh, &ev, file->f_flags & O_NONBLOCK);

if (ret)
return ret;

evN->type = ev.type;
memcpy(&evN->u.data, &ev.u.data, 64);
evN->pending = ev.pending;
evN->sequence = ev.sequence;
evN->timestamp.tv_sec = ev.timestamp.tv_sec;
evN->timestamp.tv_nsec = ev.timestamp.tv_nsec;

return ret;

case VIDIOC_SUBSCRIBE_EVENT:
return v4l2_subdev_call(sd, core, subscribe_event, vfh, arg);

Expand Down
12 changes: 12 additions & 0 deletions include/linux/videodev2.h
Expand Up @@ -2481,6 +2481,17 @@ struct v4l2_event {
__u32 reserved[8];
};

struct v4l2_event_Nokia {
__u32 type;
union {
__u8 data[64];
} u;
__u32 pending;
__u32 sequence;
struct timespec timestamp;
__u32 reserved[9];
};

#define V4L2_EVENT_SUB_FL_SEND_INITIAL (1 << 0)
#define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK (1 << 1)

Expand Down Expand Up @@ -2634,6 +2645,7 @@ struct v4l2_create_buffers {
#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
#define VIDIOC_DQEVENT_NOKIA _IOR('V', 89, struct v4l2_event_Nokia)
#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)

Expand Down

0 comments on commit be54e27

Please sign in to comment.