V4L/DVB: ivtv, ivtvfb: Use a define for the output line and field register address
authorAndy Walls <awalls@radix.net>
Sat, 13 Mar 2010 23:37:25 +0000 (20:37 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 18 May 2010 03:47:15 +0000 (00:47 -0300)
Get rid of the magic number 0x28c0 used in several places in the ivtv and
ivtvfb driver and define the register address to a meaningful name.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/ivtv/ivtv-driver.h
drivers/media/video/ivtv/ivtv-ioctl.c
drivers/media/video/ivtv/ivtv-irq.c
drivers/media/video/ivtv/ivtvfb.c

index 5028e31c564a9aeed1f395b5a5274c88f61c7439..851f07de52968ee5d651eb801e8ffe8ee33b4c89 100644 (file)
 #define IVTV_REG_VPU                   (0x9058)
 #define IVTV_REG_APU                   (0xA064)
 
+/* Other registers */
+#define IVTV_REG_DEC_LINE_FIELD                (0x28C0)
+
 /* debugging */
 extern int ivtv_debug;
 
index 2192bc42c6b6a543c5458e445c7f2b63b6e96984..c29ff983d43e240dea1371ba62a3c6af82b2b499 100644 (file)
@@ -1140,7 +1140,7 @@ int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std)
                for (f = 0; f < 4; f++) {
                        prepare_to_wait(&itv->vsync_waitq, &wait,
                                        TASK_UNINTERRUPTIBLE);
-                       if ((read_reg(0x28c0) >> 16) < 100)
+                       if ((read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16) < 100)
                                break;
                        schedule_timeout(msecs_to_jiffies(25));
                }
index 12d36ca91d53fcd49147975b02dde01a2ece5ea9..dbd46c5d69753c57d357833f1fa2c2ec51be6419 100644 (file)
@@ -752,7 +752,7 @@ static void ivtv_irq_vsync(struct ivtv *itv)
         * to determine the line being displayed and ensure we handle
         * one vsync per frame.
         */
-       unsigned int frame = read_reg(0x28c0) & 1;
+       unsigned int frame = read_reg(IVTV_REG_DEC_LINE_FIELD) & 1;
        struct yuv_playback_info *yi = &itv->yuv_info;
        int last_dma_frame = atomic_read(&yi->next_dma_frame);
        struct yuv_frame_info *f = &yi->new_frame_info[last_dma_frame];
@@ -852,9 +852,11 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
                 */
                if (~itv->irqmask & IVTV_IRQ_DEC_VSYNC) {
                        /* vsync is enabled, see if we're in a new field */
-                       if ((itv->last_vsync_field & 1) != (read_reg(0x28c0) & 1)) {
+                       if ((itv->last_vsync_field & 1) !=
+                           (read_reg(IVTV_REG_DEC_LINE_FIELD) & 1)) {
                                /* New field, looks like we missed it */
-                               IVTV_DEBUG_YUV("VSync interrupt missed %d\n",read_reg(0x28c0)>>16);
+                               IVTV_DEBUG_YUV("VSync interrupt missed %d\n",
+                                      read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16);
                                vsync_force = 1;
                        }
                }
index de2ff1c6ac3476453ef1c3c59732b81510b959fe..49e1a283ed3649ec8cf55e19663e24628652d89c 100644 (file)
@@ -460,7 +460,7 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar
 
                        vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT |
                                        FB_VBLANK_HAVE_VSYNC;
-                       trace = read_reg(0x028c0) >> 16;
+                       trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16;
                        if (itv->is_50hz && trace > 312)
                                trace -= 312;
                        else if (itv->is_60hz && trace > 262)