]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/tvp5150.c
Merge git://git.linux-xtensa.org/kernel/xtensa-feed
[linux-2.6-omap-h63xx.git] / drivers / media / video / tvp5150.c
index b167ffab25202106da0bc956b8304430a48634e8..e2f1c972754bc56487222b023c2a63b5d914d4bf 100644 (file)
@@ -294,7 +294,7 @@ static inline void tvp5150_selmux(struct i2c_client *c)
        if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable)
                input = 8;
 
-       switch (input) {
+       switch (decoder->route.input) {
        case TVP5150_COMPOSITE1:
                input |= 2;
                /* fall through */
@@ -308,6 +308,11 @@ static inline void tvp5150_selmux(struct i2c_client *c)
                break;
        }
 
+       tvp5150_dbg( 1, "Selecting video route: route input=%i, output=%i "
+                       "=> tvp5150 input=%i, opmode=%i\n",
+                       decoder->route.input,decoder->route.output,
+                       input, opmode );
+
        tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode);
        tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input);
 };
@@ -945,25 +950,19 @@ static int tvp5150_command(struct i2c_client *c,
        }
 
 #ifdef CONFIG_VIDEO_ADV_DEBUG
-       case VIDIOC_INT_G_REGISTER:
-       {
-               struct v4l2_register *reg = arg;
-
-               if (reg->i2c_id != I2C_DRIVERID_TVP5150)
-                       return -EINVAL;
-               reg->val = tvp5150_read(c, reg->reg & 0xff);
-               break;
-       }
-
-       case VIDIOC_INT_S_REGISTER:
+       case VIDIOC_DBG_G_REGISTER:
+       case VIDIOC_DBG_S_REGISTER:
        {
                struct v4l2_register *reg = arg;
 
-               if (reg->i2c_id != I2C_DRIVERID_TVP5150)
+               if (!v4l2_chip_match_i2c_client(c, reg->match_type, reg->match_chip))
                        return -EINVAL;
                if (!capable(CAP_SYS_ADMIN))
                        return -EPERM;
-               tvp5150_write(c, reg->reg & 0xff, reg->val & 0xff);
+               if (cmd == VIDIOC_DBG_G_REGISTER)
+                       reg->val = tvp5150_read(c, reg->reg & 0xff);
+               else
+                       tvp5150_write(c, reg->reg & 0xff, reg->val & 0xff);
                break;
        }
 #endif
@@ -1007,7 +1006,7 @@ static int tvp5150_command(struct i2c_client *c,
                {
                        struct v4l2_control *ctrl = arg;
                        u8 i, n;
-                       n = sizeof(tvp5150_qctrl) / sizeof(tvp5150_qctrl[0]);
+                       n = ARRAY_SIZE(tvp5150_qctrl);
                        for (i = 0; i < n; i++)
                                if (ctrl->id == tvp5150_qctrl[i].id) {
                                        if (ctrl->value <