[media] v4l: Convert drivers to use monotonic timestamps
authorSakari Ailus <sakari.ailus@iki.fi>
Sat, 15 Sep 2012 18:14:42 +0000 (15:14 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 21 Dec 2012 12:56:43 +0000 (10:56 -0200)
Convert drivers using wall clock time (CLOCK_REALTIME) to timestamp from the
monotonic timer (CLOCK_MONOTONIC).

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
43 files changed:
drivers/media/common/saa7146/saa7146_fops.c
drivers/media/pci/bt8xx/bttv-driver.c
drivers/media/pci/cx23885/cx23885-core.c
drivers/media/pci/cx23885/cx23885-video.c
drivers/media/pci/cx25821/cx25821-video.c
drivers/media/pci/cx88/cx88-core.c
drivers/media/pci/meye/meye.c
drivers/media/pci/saa7134/saa7134-core.c
drivers/media/pci/sta2x11/sta2x11_vip.c
drivers/media/pci/zoran/zoran_device.c
drivers/media/platform/blackfin/bfin_capture.c
drivers/media/platform/davinci/vpfe_capture.c
drivers/media/platform/davinci/vpif_capture.c
drivers/media/platform/davinci/vpif_display.c
drivers/media/platform/fsl-viu.c
drivers/media/platform/omap/omap_vout.c
drivers/media/platform/omap24xxcam.c
drivers/media/platform/sh_vou.c
drivers/media/platform/soc_camera/atmel-isi.c
drivers/media/platform/soc_camera/mx1_camera.c
drivers/media/platform/soc_camera/mx2_camera.c
drivers/media/platform/soc_camera/mx3_camera.c
drivers/media/platform/soc_camera/omap1_camera.c
drivers/media/platform/soc_camera/pxa_camera.c
drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
drivers/media/platform/timblogiw.c
drivers/media/platform/vino.c
drivers/media/platform/vivi.c
drivers/media/usb/au0828/au0828-video.c
drivers/media/usb/cpia2/cpia2_usb.c
drivers/media/usb/cx231xx/cx231xx-417.c
drivers/media/usb/cx231xx/cx231xx-vbi.c
drivers/media/usb/cx231xx/cx231xx-video.c
drivers/media/usb/em28xx/em28xx-video.c
drivers/media/usb/pwc/pwc-if.c
drivers/media/usb/s2255/s2255drv.c
drivers/media/usb/sn9c102/sn9c102_core.c
drivers/media/usb/stk1160/stk1160-video.c
drivers/media/usb/stkwebcam/stk-webcam.c
drivers/media/usb/tlg2300/pd-video.c
drivers/media/usb/tm6000/tm6000-video.c
drivers/media/usb/usbvision/usbvision-core.c
drivers/media/usb/zr364xx/zr364xx.c

index b3890bd49df6089fa0871f70d7b09abc47375b4c..2652f9155c347a0e9ac2e83f82933c5ddfe40f7b 100644 (file)
@@ -105,7 +105,7 @@ void saa7146_buffer_finish(struct saa7146_dev *dev,
        }
 
        q->curr->vb.state = state;
-       do_gettimeofday(&q->curr->vb.ts);
+       v4l2_get_timestamp(&q->curr->vb.ts);
        wake_up(&q->curr->vb.done);
 
        q->curr = NULL;
index de6f41f19187dd584be669baadc0398910e71b2b..346458bba2c533c43ccd3cc3337c29ae5ac919ea 100644 (file)
@@ -3835,7 +3835,7 @@ bttv_irq_wakeup_video(struct bttv *btv, struct bttv_buffer_set *wakeup,
 {
        struct timeval ts;
 
-       do_gettimeofday(&ts);
+       v4l2_get_timestamp(&ts);
 
        if (wakeup->top == wakeup->bottom) {
                if (NULL != wakeup->top && curr->top != wakeup->top) {
@@ -3878,7 +3878,7 @@ bttv_irq_wakeup_vbi(struct bttv *btv, struct bttv_buffer *wakeup,
        if (NULL == wakeup)
                return;
 
-       do_gettimeofday(&ts);
+       v4l2_get_timestamp(&ts);
        wakeup->vb.ts = ts;
        wakeup->vb.field_count = btv->field_count;
        wakeup->vb.state = state;
@@ -3949,7 +3949,7 @@ bttv_irq_wakeup_top(struct bttv *btv)
        btv->curr.top = NULL;
        bttv_risc_hook(btv, RISC_SLOT_O_FIELD, NULL, 0);
 
-       do_gettimeofday(&wakeup->vb.ts);
+       v4l2_get_timestamp(&wakeup->vb.ts);
        wakeup->vb.field_count = btv->field_count;
        wakeup->vb.state = VIDEOBUF_DONE;
        wake_up(&wakeup->vb.done);
index 065ecd54bda3d6127b4ff0ab8e846c41924b3d96..c7572594d43499f2851eb6513f576ccbb19de35f 100644 (file)
@@ -439,7 +439,7 @@ void cx23885_wakeup(struct cx23885_tsport *port,
                if ((s16) (count - buf->count) < 0)
                        break;
 
-               do_gettimeofday(&buf->vb.ts);
+               v4l2_get_timestamp(&buf->vb.ts);
                dprintk(2, "[%p/%d] wakeup reg=%d buf=%d\n", buf, buf->vb.i,
                        count, buf->count);
                buf->vb.state = VIDEOBUF_DONE;
index 1a21926ca412cbdab3cdb00841e40e930818f470..83975313e0f2fb85e12ab1e6de70b89984e83993 100644 (file)
@@ -300,7 +300,7 @@ void cx23885_video_wakeup(struct cx23885_dev *dev,
                if ((s16) (count - buf->count) < 0)
                        break;
 
-               do_gettimeofday(&buf->vb.ts);
+               v4l2_get_timestamp(&buf->vb.ts);
                dprintk(2, "[%p/%d] wakeup reg=%d buf=%d\n", buf, buf->vb.i,
                        count, buf->count);
                buf->vb.state = VIDEOBUF_DONE;
index 53b16dd7032054a0afce16de3037350e012214c6..d4de021dc844e88776f67e7b08018cf9ab11b394 100644 (file)
@@ -130,7 +130,7 @@ void cx25821_video_wakeup(struct cx25821_dev *dev, struct cx25821_dmaqueue *q,
                if ((s16) (count - buf->count) < 0)
                        break;
 
-               do_gettimeofday(&buf->vb.ts);
+               v4l2_get_timestamp(&buf->vb.ts);
                buf->vb.state = VIDEOBUF_DONE;
                list_del(&buf->vb.queue);
                wake_up(&buf->vb.done);
index 19a58754c6e14ee3d91152738464382edf16ab30..39f095c37ffd4462faa98b28c32efde6c112b254 100644 (file)
@@ -549,7 +549,7 @@ void cx88_wakeup(struct cx88_core *core,
                 * up to 32767 buffers in flight... */
                if ((s16) (count - buf->count) < 0)
                        break;
-               do_gettimeofday(&buf->vb.ts);
+               v4l2_get_timestamp(&buf->vb.ts);
                dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i,
                        count, buf->count);
                buf->vb.state = VIDEOBUF_DONE;
index ae7d32027bf726e0e73499880a61a07187fa6744..288adea55e3321ec060db3edf786808e6538ddf2 100644 (file)
@@ -811,7 +811,7 @@ again:
                                      mchip_hsize() * mchip_vsize() * 2);
                meye.grab_buffer[reqnr].size = mchip_hsize() * mchip_vsize() * 2;
                meye.grab_buffer[reqnr].state = MEYE_BUF_DONE;
-               do_gettimeofday(&meye.grab_buffer[reqnr].timestamp);
+               v4l2_get_timestamp(&meye.grab_buffer[reqnr].timestamp);
                meye.grab_buffer[reqnr].sequence = sequence++;
                kfifo_in_locked(&meye.doneq, (unsigned char *)&reqnr,
                                sizeof(int), &meye.doneq_lock);
@@ -832,7 +832,7 @@ again:
                       size);
                meye.grab_buffer[reqnr].size = size;
                meye.grab_buffer[reqnr].state = MEYE_BUF_DONE;
-               do_gettimeofday(&meye.grab_buffer[reqnr].timestamp);
+               v4l2_get_timestamp(&meye.grab_buffer[reqnr].timestamp);
                meye.grab_buffer[reqnr].sequence = sequence++;
                kfifo_in_locked(&meye.doneq, (unsigned char *)&reqnr,
                                sizeof(int), &meye.doneq_lock);
index 8976d0e65813d26d7c2761d7172fd7549899d1d4..e1aeb51e25ba8a112f0bb233e929cf377c2ab4aa 100644 (file)
@@ -308,7 +308,7 @@ void saa7134_buffer_finish(struct saa7134_dev *dev,
 
        /* finish current buffer */
        q->curr->vb.state = state;
-       do_gettimeofday(&q->curr->vb.ts);
+       v4l2_get_timestamp(&q->curr->vb.ts);
        wake_up(&q->curr->vb.done);
        q->curr = NULL;
 }
index 4c10205264d4d7c0e2ba25ae48e999bb1aa593a7..ed1337a89a268df51462753ad493bc2b0089272c 100644 (file)
@@ -1088,7 +1088,7 @@ static irqreturn_t vip_irq(int irq, struct sta2x11_vip *vip)
 
        REG_WRITE(vip, DVP_CTL, REG_READ(vip, DVP_CTL) & ~DVP_CTL_ENA);
        if (vip->active) {
-               do_gettimeofday(&vip->active->ts);
+               v4l2_get_timestamp(&vip->active->ts);
                vip->active->field_count++;
                vip->active->state = VIDEOBUF_DONE;
                wake_up(&vip->active->done);
index a4cd504b8eeed5001648fb651b3c43f45d1a099a..519164c572c83161ada2bef277ebe5d08ab1d535 100644 (file)
@@ -1169,7 +1169,7 @@ zoran_reap_stat_com (struct zoran *zr)
                }
                frame = zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME];
                buffer = &zr->jpg_buffers.buffer[frame];
-               do_gettimeofday(&buffer->bs.timestamp);
+               v4l2_get_timestamp(&buffer->bs.timestamp);
 
                if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) {
                        buffer->bs.length = (stat_com & 0x7fffff) >> 1;
@@ -1407,7 +1407,7 @@ zoran_irq (int             irq,
 
                                                zr->v4l_buffers.buffer[zr->v4l_grab_frame].state = BUZ_STATE_DONE;
                                                zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.seq = zr->v4l_grab_seq;
-                                               do_gettimeofday(&zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.timestamp);
+                                               v4l2_get_timestamp(&zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.timestamp);
                                                zr->v4l_grab_frame = NO_GRAB_ACTIVE;
                                                zr->v4l_pend_tail++;
                                        }
index ec476ef5b709bbe8c56e354e6fecb5d3c70902d5..d422d3c379e4368bac2dde9790913111cd481ffa 100644 (file)
@@ -484,15 +484,13 @@ static irqreturn_t bcap_isr(int irq, void *dev_id)
 {
        struct ppi_if *ppi = dev_id;
        struct bcap_device *bcap_dev = ppi->priv;
-       struct timeval timevalue;
        struct vb2_buffer *vb = &bcap_dev->cur_frm->vb;
        dma_addr_t addr;
 
        spin_lock(&bcap_dev->lock);
 
        if (bcap_dev->cur_frm != bcap_dev->next_frm) {
-               do_gettimeofday(&timevalue);
-               vb->v4l2_buf.timestamp = timevalue;
+               v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
                vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
                bcap_dev->cur_frm = bcap_dev->next_frm;
        }
index 8be492cd8ed46bf58a9cd79ce4d26ed8474404aa..65f4264bd5b448244d132fa4210f58a0d258b890 100644 (file)
@@ -560,10 +560,7 @@ static void vpfe_schedule_bottom_field(struct vpfe_device *vpfe_dev)
 
 static void vpfe_process_buffer_complete(struct vpfe_device *vpfe_dev)
 {
-       struct timeval timevalue;
-
-       do_gettimeofday(&timevalue);
-       vpfe_dev->cur_frm->ts = timevalue;
+       v4l2_get_timestamp(&vpfe_dev->cur_frm->ts);
        vpfe_dev->cur_frm->state = VIDEOBUF_DONE;
        vpfe_dev->cur_frm->size = vpfe_dev->fmt.fmt.pix.sizeimage;
        wake_up_interruptible(&vpfe_dev->cur_frm->done);
index a409ccefb38073ec2c67d74d96ea53079bc6f38a..5892d2bc8eeef5d844d53f144bca0ea35f1fde7a 100644 (file)
@@ -411,7 +411,7 @@ static struct vb2_ops video_qops = {
  */
 static void vpif_process_buffer_complete(struct common_obj *common)
 {
-       do_gettimeofday(&common->cur_frm->vb.v4l2_buf.timestamp);
+       v4l2_get_timestamp(&common->cur_frm->vb.v4l2_buf.timestamp);
        vb2_buffer_done(&common->cur_frm->vb,
                                            VB2_BUF_STATE_DONE);
        /* Make curFrm pointing to nextFrm */
index 9f2b603be9c9b319d56b72bd99c3028df07632aa..dd249c96126dee69e6fd883f0459eefc26418baf 100644 (file)
@@ -402,7 +402,7 @@ static void process_interlaced_mode(int fid, struct common_obj *common)
                /* one frame is displayed If next frame is
                 *  available, release cur_frm and move on */
                /* Copy frame display time */
-               do_gettimeofday(&common->cur_frm->vb.v4l2_buf.timestamp);
+               v4l2_get_timestamp(&common->cur_frm->vb.v4l2_buf.timestamp);
                /* Change status of the cur_frm */
                vb2_buffer_done(&common->cur_frm->vb,
                                            VB2_BUF_STATE_DONE);
@@ -462,8 +462,8 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
                        if (!channel_first_int[i][channel_id]) {
                                /* Mark status of the cur_frm to
                                 * done and unlock semaphore on it */
-                               do_gettimeofday(&common->cur_frm->vb.
-                                               v4l2_buf.timestamp);
+                               v4l2_get_timestamp(&common->cur_frm->vb.
+                                                  v4l2_buf.timestamp);
                                vb2_buffer_done(&common->cur_frm->vb,
                                            VB2_BUF_STATE_DONE);
                                /* Make cur_frm pointing to next_frm */
index a8ddb0cacab82cc7d81e5c3f17b6d4d5f29d9a2a..d464509d0f0e1dbd8e0149f0e340ba6042e68602 100644 (file)
@@ -1181,7 +1181,7 @@ static void viu_capture_intr(struct viu_dev *dev, u32 status)
 
                if (waitqueue_active(&buf->vb.done)) {
                        list_del(&buf->vb.queue);
-                       do_gettimeofday(&buf->vb.ts);
+                       v4l2_get_timestamp(&buf->vb.ts);
                        buf->vb.state = VIDEOBUF_DONE;
                        buf->vb.field_count++;
                        wake_up(&buf->vb.done);
index f7ad54106bc5b08c153d396a790e7ec09d5031dc..c74b0d48dcd69ea9152882c680c5c60327597f0c 100644 (file)
@@ -597,7 +597,7 @@ static void omap_vout_isr(void *arg, unsigned int irqstatus)
                return;
 
        spin_lock(&vout->vbq_lock);
-       do_gettimeofday(&timevalue);
+       v4l2_get_timestamp(&timevalue);
 
        switch (cur_display->type) {
        case OMAP_DISPLAY_TYPE_DSI:
index 70f45c381318929f4b80b70025fb368305a0b788..eda3274abf8edab4149e9c4c1d0ef4a80c174ed8 100644 (file)
@@ -402,7 +402,7 @@ static void omap24xxcam_vbq_complete(struct omap24xxcam_sgdma *sgdma,
                omap24xxcam_core_disable(cam);
        spin_unlock_irqrestore(&cam->core_enable_disable_lock, flags);
 
-       do_gettimeofday(&vb->ts);
+       v4l2_get_timestamp(&vb->ts);
        vb->field_count = atomic_add_return(2, &fh->field_count);
        if (csr & csr_error) {
                vb->state = VIDEOBUF_ERROR;
index 7494858a21587ee7c6f8d61943bf80e9b150f791..1039ae82401bfbe37dd4209815ed7c611231c967 100644 (file)
@@ -1092,7 +1092,7 @@ static irqreturn_t sh_vou_isr(int irq, void *dev_id)
        list_del(&vb->queue);
 
        vb->state = VIDEOBUF_DONE;
-       do_gettimeofday(&vb->ts);
+       v4l2_get_timestamp(&vb->ts);
        vb->field_count++;
        wake_up(&vb->done);
 
index 6274a91c25c74b711f30510a584056697edaa6ed..c8d748a31944e2d7ab2921a3c2b173f77124e789 100644 (file)
@@ -166,7 +166,7 @@ static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi)
                struct frame_buffer *buf = isi->active;
 
                list_del_init(&buf->list);
-               do_gettimeofday(&vb->v4l2_buf.timestamp);
+               v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
                vb->v4l2_buf.sequence = isi->sequence++;
                vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
        }
index 032b8c9097f99a7d35866a242b7897302b260860..674ded646b66fc257ffe141a5d919098faca44ed 100644 (file)
@@ -307,7 +307,7 @@ static void mx1_camera_wakeup(struct mx1_camera_dev *pcdev,
        /* _init is used to debug races, see comment in mx1_camera_reqbufs() */
        list_del_init(&vb->queue);
        vb->state = VIDEOBUF_DONE;
-       do_gettimeofday(&vb->ts);
+       v4l2_get_timestamp(&vb->ts);
        vb->field_count++;
        wake_up(&vb->done);
 
index 2c148028d8c0c096f92e96ec105b7b6afe7d2dc1..3c5ba63cd3112ae97d409749907727a25e1144b4 100644 (file)
@@ -516,7 +516,7 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb,
        dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%p %lu\n", __func__,
                vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0));
 
-       do_gettimeofday(&vb->v4l2_buf.timestamp);
+       v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
        vb->v4l2_buf.sequence++;
        vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
 
@@ -1561,7 +1561,7 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev,
                                vb2_get_plane_payload(vb, 0));
 
                list_del_init(&buf->internal.queue);
-               do_gettimeofday(&vb->v4l2_buf.timestamp);
+               v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
                vb->v4l2_buf.sequence = pcdev->frame_count;
                if (err)
                        vb2_buffer_done(vb, VB2_BUF_STATE_ERROR);
index 261f6e9e1b176dcbc543992204162673f06935c4..e6bc06bca496e232dc8a2864e3bb745e294c38cd 100644 (file)
@@ -156,7 +156,7 @@ static void mx3_cam_dma_done(void *arg)
                struct mx3_camera_buffer *buf = to_mx3_vb(vb);
 
                list_del_init(&buf->queue);
-               do_gettimeofday(&vb->v4l2_buf.timestamp);
+               v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
                vb->v4l2_buf.field = mx3_cam->field;
                vb->v4l2_buf.sequence = mx3_cam->sequence++;
                vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
index 13636a58510606635a69cda964f57054a2e607b7..b573bd5899de3d8f6243e8d419fcbb78ca06c8cb 100644 (file)
@@ -591,7 +591,7 @@ static void videobuf_done(struct omap1_cam_dev *pcdev,
                        suspend_capture(pcdev);
                }
                vb->state = result;
-               do_gettimeofday(&vb->ts);
+               v4l2_get_timestamp(&vb->ts);
                if (result != VIDEOBUF_ERROR)
                        vb->field_count++;
                wake_up(&vb->done);
index 3434ffe79c6ecc445a8b451dc2c55767b552c217..8ff961eec39d43d2ebe0c540f6ebbef80f0b2911 100644 (file)
@@ -681,7 +681,7 @@ static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev,
        /* _init is used to debug races, see comment in pxa_camera_reqbufs() */
        list_del_init(&vb->queue);
        vb->state = VIDEOBUF_DONE;
-       do_gettimeofday(&vb->ts);
+       v4l2_get_timestamp(&vb->ts);
        vb->field_count++;
        wake_up(&vb->done);
        dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s dequeud buffer (vb=0x%p)\n",
index 27eeca15bbf07e584d9f83f4947d9087f40c4a21..9f021043cfe679d68ee1510da9005698698f6897 100644 (file)
@@ -516,7 +516,7 @@ static irqreturn_t sh_mobile_ceu_irq(int irq, void *data)
                pcdev->active = NULL;
 
        ret = sh_mobile_ceu_capture(pcdev);
-       do_gettimeofday(&vb->v4l2_buf.timestamp);
+       v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
        if (!ret) {
                vb->v4l2_buf.field = pcdev->field;
                vb->v4l2_buf.sequence = pcdev->sequence++;
index 02194c056b005f601d5d6743221f38c7f67971ab..9de014100a0fcce6ba85c4efa40438fce5e9f879 100644 (file)
@@ -130,7 +130,7 @@ static void timblogiw_dma_cb(void *data)
 
        if (vb->state != VIDEOBUF_ERROR) {
                list_del(&vb->queue);
-               do_gettimeofday(&vb->ts);
+               v4l2_get_timestamp(&vb->ts);
                vb->field_count = fh->frame_count * 2;
                vb->state = VIDEOBUF_DONE;
 
index 70b0bf4b2900ecd5e5619e85cf66dcc7c36de636..28350e78b5645353b4aec52503d9711ac8503e34 100644 (file)
@@ -2474,8 +2474,8 @@ static irqreturn_t vino_interrupt(int irq, void *dev_id)
 
                if ((!handled_a) && (done_a || skip_a)) {
                        if (!skip_a) {
-                               do_gettimeofday(&vino_drvdata->
-                                               a.int_data.timestamp);
+                               v4l2_get_timestamp(
+                                       &vino_drvdata->a.int_data.timestamp);
                                vino_drvdata->a.int_data.frame_counter = fc_a;
                        }
                        vino_drvdata->a.int_data.skip = skip_a;
@@ -2489,8 +2489,8 @@ static irqreturn_t vino_interrupt(int irq, void *dev_id)
 
                if ((!handled_b) && (done_b || skip_b)) {
                        if (!skip_b) {
-                               do_gettimeofday(&vino_drvdata->
-                                               b.int_data.timestamp);
+                               v4l2_get_timestamp(
+                                       &vino_drvdata->b.int_data.timestamp);
                                vino_drvdata->b.int_data.frame_counter = fc_b;
                        }
                        vino_drvdata->b.int_data.skip = skip_b;
index 0d59b9db83cb90b4d2ec1f38482111cdadbb77f5..c2f424f32450b37dcabe340e367a1006227f93d1 100644 (file)
@@ -554,7 +554,6 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf)
 {
        int wmax = dev->width;
        int hmax = dev->height;
-       struct timeval ts;
        void *vbuf = vb2_plane_vaddr(&buf->vb, 0);
        unsigned ms;
        char str[100];
@@ -622,8 +621,7 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf)
        buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED;
        dev->field_count++;
        buf->vb.v4l2_buf.sequence = dev->field_count >> 1;
-       do_gettimeofday(&ts);
-       buf->vb.v4l2_buf.timestamp = ts;
+       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
 }
 
 static void vivi_thread_tick(struct vivi_dev *dev)
@@ -645,7 +643,7 @@ static void vivi_thread_tick(struct vivi_dev *dev)
        list_del(&buf->list);
        spin_unlock_irqrestore(&dev->slock, flags);
 
-       do_gettimeofday(&buf->vb.v4l2_buf.timestamp);
+       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
 
        /* Fill buffer */
        vivi_fillbuff(dev, buf);
index 45387aab10c7ca5633c66c8616c4beb978039594..8b9e8268e911d2589f2758f8631f428518013019 100644 (file)
@@ -304,7 +304,7 @@ static inline void buffer_filled(struct au0828_dev *dev,
 
        buf->vb.state = VIDEOBUF_DONE;
        buf->vb.field_count++;
-       do_gettimeofday(&buf->vb.ts);
+       v4l2_get_timestamp(&buf->vb.ts);
 
        dev->isoc_ctl.buf = NULL;
 
@@ -321,7 +321,7 @@ static inline void vbi_buffer_filled(struct au0828_dev *dev,
 
        buf->vb.state = VIDEOBUF_DONE;
        buf->vb.field_count++;
-       do_gettimeofday(&buf->vb.ts);
+       v4l2_get_timestamp(&buf->vb.ts);
 
        dev->isoc_ctl.vbi_buf = NULL;
 
index 95b5d6e7cdc400d348dcb7462f7806c68e578a43..be17192836099c4e1759e2e7a9d41cf7e9cf3a33 100644 (file)
@@ -328,7 +328,7 @@ static void cpia2_usb_complete(struct urb *urb)
                                continue;
                        }
                        DBG("Start of frame pattern found\n");
-                       do_gettimeofday(&cam->workbuff->timestamp);
+                       v4l2_get_timestamp(&cam->workbuff->timestamp);
                        cam->workbuff->seq = cam->frame_count++;
                        cam->workbuff->data[0] = 0xFF;
                        cam->workbuff->data[1] = 0xD8;
index b024e5197a755fa01cc36fff2be2c7be1a876740..28688dbcb6090cfab70386e7ac03b3526875598e 100644 (file)
@@ -1291,7 +1291,7 @@ static void buffer_copy(struct cx231xx *dev, char *data, int len, struct urb *ur
 
                        buf->vb.state = VIDEOBUF_DONE;
                        buf->vb.field_count++;
-                       do_gettimeofday(&buf->vb.ts);
+                       v4l2_get_timestamp(&buf->vb.ts);
                        list_del(&buf->vb.queue);
                        wake_up(&buf->vb.done);
                        dma_q->mpeg_buffer_completed = 0;
@@ -1327,7 +1327,7 @@ static void buffer_filled(char *data, int len, struct urb *urb,
                memcpy(vbuf, data, len);
                buf->vb.state = VIDEOBUF_DONE;
                buf->vb.field_count++;
-               do_gettimeofday(&buf->vb.ts);
+               v4l2_get_timestamp(&buf->vb.ts);
                list_del(&buf->vb.queue);
                wake_up(&buf->vb.done);
 
index ac7db52f404ffbc9c95207f7a2bd5b1414aa4187..46e3892557c2127b3e022b85056d529ec2d02f4c 100644 (file)
@@ -530,7 +530,7 @@ static inline void vbi_buffer_filled(struct cx231xx *dev,
 
        buf->vb.state = VIDEOBUF_DONE;
        buf->vb.field_count++;
-       do_gettimeofday(&buf->vb.ts);
+       v4l2_get_timestamp(&buf->vb.ts);
 
        dev->vbi_mode.bulk_ctl.buf = NULL;
 
index fedf7852a355c8e2fff3575769b0237c3fa33105..239cb913be5ccaed49b9594825c23509183ae99c 100644 (file)
@@ -235,7 +235,7 @@ static inline void buffer_filled(struct cx231xx *dev,
        cx231xx_isocdbg("[%p/%d] wakeup\n", buf, buf->vb.i);
        buf->vb.state = VIDEOBUF_DONE;
        buf->vb.field_count++;
-       do_gettimeofday(&buf->vb.ts);
+       v4l2_get_timestamp(&buf->vb.ts);
 
        if (dev->USE_ISO)
                dev->video_mode.isoc_ctl.buf = NULL;
index 1e553d3573805795dc8cb1debdbd50f82d6a42c4..766ad125fc08c522539547284c89a83e9fa9a8bb 100644 (file)
@@ -163,7 +163,7 @@ static inline void buffer_filled(struct em28xx *dev,
        em28xx_isocdbg("[%p/%d] wakeup\n", buf, buf->vb.i);
        buf->vb.state = VIDEOBUF_DONE;
        buf->vb.field_count++;
-       do_gettimeofday(&buf->vb.ts);
+       v4l2_get_timestamp(&buf->vb.ts);
 
        dev->isoc_ctl.vid_buf = NULL;
 
@@ -180,7 +180,7 @@ static inline void vbi_buffer_filled(struct em28xx *dev,
 
        buf->vb.state = VIDEOBUF_DONE;
        buf->vb.field_count++;
-       do_gettimeofday(&buf->vb.ts);
+       v4l2_get_timestamp(&buf->vb.ts);
 
        dev->isoc_ctl.vbi_buf = NULL;
 
index 5210239cbaeefcc9b92cd548bfbe1c010fd6b89d..21c15233c6ae1556384add1f5a994b98e4bf9c56 100644 (file)
@@ -316,7 +316,8 @@ static void pwc_isoc_handler(struct urb *urb)
                        struct pwc_frame_buf *fbuf = pdev->fill_buf;
 
                        if (pdev->vsync == 1) {
-                               do_gettimeofday(&fbuf->vb.v4l2_buf.timestamp);
+                               v4l2_get_timestamp(
+                                       &fbuf->vb.v4l2_buf.timestamp);
                                pdev->vsync = 2;
                        }
 
index 8ebec0d7bf59509bd19ea1756528e1e9407fbe45..498c57ea5d32c2c0176aea4ca0f429a2eded85b6 100644 (file)
@@ -593,7 +593,7 @@ static int s2255_got_frame(struct s2255_channel *channel, int jpgsize)
        buf = list_entry(dma_q->active.next,
                         struct s2255_buffer, vb.queue);
        list_del(&buf->vb.queue);
-       do_gettimeofday(&buf->vb.ts);
+       v4l2_get_timestamp(&buf->vb.ts);
        s2255_fillbuff(channel, buf, jpgsize);
        wake_up(&buf->vb.done);
        dprintk(2, "%s: [buf/i] [%p/%d]\n", __func__, buf, buf->vb.i);
@@ -629,7 +629,6 @@ static void s2255_fillbuff(struct s2255_channel *channel,
                           struct s2255_buffer *buf, int jpgsize)
 {
        int pos = 0;
-       struct timeval ts;
        const char *tmpbuf;
        char *vbuf = videobuf_to_vmalloc(&buf->vb);
        unsigned long last_frame;
@@ -674,8 +673,7 @@ static void s2255_fillbuff(struct s2255_channel *channel,
        /* tell v4l buffer was filled */
 
        buf->vb.field_count = channel->frame_count * 2;
-       do_gettimeofday(&ts);
-       buf->vb.ts = ts;
+       v4l2_get_timestamp(&buf->vb.ts);
        buf->vb.state = VIDEOBUF_DONE;
 }
 
index 73605864fffadb98ce9e780cf8499bee83a1704c..8dbf0c721c4aed65a158794238f9feddfee833e5 100644 (file)
@@ -773,7 +773,8 @@ end_of_frame:
                                       img);
 
                                if ((*f)->buf.bytesused == 0)
-                                       do_gettimeofday(&(*f)->buf.timestamp);
+                                       v4l2_get_timestamp(
+                                               &(*f)->buf.timestamp);
 
                                (*f)->buf.bytesused += img;
 
index fa3671de02aa66081019f9d102339a0c6873f972..0a4ee85f43999e2d9374453ecf86339e2006ea7d 100644 (file)
@@ -101,7 +101,7 @@ void stk1160_buffer_done(struct stk1160 *dev)
        buf->vb.v4l2_buf.sequence = dev->field_count >> 1;
        buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED;
        buf->vb.v4l2_buf.bytesused = buf->bytesused;
-       do_gettimeofday(&buf->vb.v4l2_buf.timestamp);
+       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
 
        vb2_set_plane_payload(&buf->vb, 0, buf->bytesused);
        vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
index 5d3c032d733cf6e92ca7b345de95862204cd3d91..bf56904decb421f161745a5611e84d819c4890ff 100644 (file)
@@ -1113,7 +1113,7 @@ static int stk_vidioc_dqbuf(struct file *filp,
        sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED;
        sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_DONE;
        sbuf->v4lbuf.sequence = ++dev->sequence;
-       do_gettimeofday(&sbuf->v4lbuf.timestamp);
+       v4l2_get_timestamp(&sbuf->v4lbuf.timestamp);
 
        *buf = sbuf->v4lbuf;
        return 0;
index 3082bfa9b2c5d60fdc38a383344f915564b86e2f..21723378bb8f7d7ae84ab647958b9066ab1e3c34 100644 (file)
@@ -212,7 +212,7 @@ static void submit_frame(struct front_face *front)
        front->curr_frame       = NULL;
        vb->state               = VIDEOBUF_DONE;
        vb->field_count++;
-       do_gettimeofday(&vb->ts);
+       v4l2_get_timestamp(&vb->ts);
 
        wake_up(&vb->done);
 }
index 1edc2517603f33a812ef1202dc1541817a4f7900..e3c567c27918bd7321e168550df3df0e5941f8bf 100644 (file)
@@ -194,7 +194,7 @@ static inline void buffer_filled(struct tm6000_core *dev,
        dprintk(dev, V4L2_DEBUG_ISOC, "[%p/%d] wakeup\n", buf, buf->vb.i);
        buf->vb.state = VIDEOBUF_DONE;
        buf->vb.field_count++;
-       do_gettimeofday(&buf->vb.ts);
+       v4l2_get_timestamp(&buf->vb.ts);
 
        list_del(&buf->vb.queue);
        wake_up(&buf->vb.done);
index c9b2042f8bdfa9310b7d3c53eb50181a0647a31d..816b1cffab7de245e49fb69fc1ea00876ff78cce 100644 (file)
@@ -1169,7 +1169,7 @@ static void usbvision_parse_data(struct usb_usbvision *usbvision)
 
        if (newstate == parse_state_next_frame) {
                frame->grabstate = frame_state_done;
-               do_gettimeofday(&(frame->timestamp));
+               v4l2_get_timestamp(&(frame->timestamp));
                frame->sequence = usbvision->frame_num;
 
                spin_lock_irqsave(&usbvision->queue_lock, lock_flags);
index 39edd444293226406a4faed135930dcf09ff059c..74d56df3347f59329ec6c4538023592c863bc1ac 100644 (file)
@@ -501,7 +501,6 @@ static void zr364xx_fillbuff(struct zr364xx_camera *cam,
                             int jpgsize)
 {
        int pos = 0;
-       struct timeval ts;
        const char *tmpbuf;
        char *vbuf = videobuf_to_vmalloc(&buf->vb);
        unsigned long last_frame;
@@ -530,8 +529,7 @@ static void zr364xx_fillbuff(struct zr364xx_camera *cam,
        /* tell v4l buffer was filled */
 
        buf->vb.field_count = cam->frame_count * 2;
-       do_gettimeofday(&ts);
-       buf->vb.ts = ts;
+       v4l2_get_timestamp(&buf->vb.ts);
        buf->vb.state = VIDEOBUF_DONE;
 }
 
@@ -559,7 +557,7 @@ static int zr364xx_got_frame(struct zr364xx_camera *cam, int jpgsize)
                goto unlock;
        }
        list_del(&buf->vb.queue);
-       do_gettimeofday(&buf->vb.ts);
+       v4l2_get_timestamp(&buf->vb.ts);
        DBG("[%p/%d] wakeup\n", buf, buf->vb.i);
        zr364xx_fillbuff(cam, buf, jpgsize);
        wake_up(&buf->vb.done);