V4L/DVB (11253): saa7134: fix RTD Embedded Technologies VFG7350 support.
[pandora-kernel.git] / drivers / media / video / saa7134 / saa7134-empress.c
index c9d8beb..9db3472 100644 (file)
@@ -76,7 +76,7 @@ static int ts_init_encoder(struct saa7134_dev* dev)
                break;
        }
        ts_reset_encoder(dev);
-       saa7134_i2c_call_clients(dev, VIDIOC_INT_INIT, &leading_null_bytes);
+       saa_call_all(dev, core, init, leading_null_bytes);
        dev->empress_started = 1;
        return 0;
 }
@@ -234,7 +234,7 @@ static int empress_g_fmt_vid_cap(struct file *file, void *priv,
 {
        struct saa7134_dev *dev = file->private_data;
 
-       saa7134_i2c_call_clients(dev, VIDIOC_G_FMT, f);
+       saa_call_all(dev, video, g_fmt, f);
 
        f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
        f->fmt.pix.sizeimage    = TS_PACKET_SIZE * dev->ts.nr_packets;
@@ -247,7 +247,7 @@ static int empress_s_fmt_vid_cap(struct file *file, void *priv,
 {
        struct saa7134_dev *dev = file->private_data;
 
-       saa7134_i2c_call_clients(dev, VIDIOC_S_FMT, f);
+       saa_call_all(dev, video, s_fmt, f);
 
        f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
        f->fmt.pix.sizeimage    = TS_PACKET_SIZE * dev->ts.nr_packets;
@@ -317,7 +317,7 @@ static int empress_s_ext_ctrls(struct file *file, void *priv,
        if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG)
                return -EINVAL;
 
-       err = saa7134_i2c_call_saa6752(dev, VIDIOC_S_EXT_CTRLS, ctrls);
+       err = saa_call_empress(dev, core, s_ext_ctrls, ctrls);
        ts_init_encoder(dev);
 
        return err;
@@ -330,7 +330,7 @@ static int empress_g_ext_ctrls(struct file *file, void *priv,
 
        if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG)
                return -EINVAL;
-       return saa7134_i2c_call_saa6752(dev, VIDIOC_G_EXT_CTRLS, ctrls);
+       return saa_call_empress(dev, core, g_ext_ctrls, ctrls);
 }
 
 static int empress_g_ctrl(struct file *file, void *priv,
@@ -352,6 +352,7 @@ static int empress_s_ctrl(struct file *file, void *priv,
 static int empress_queryctrl(struct file *file, void *priv,
                                        struct v4l2_queryctrl *c)
 {
+       /* Must be sorted from low to high control ID! */
        static const u32 user_ctrls[] = {
                V4L2_CID_USER_CLASS,
                V4L2_CID_BRIGHTNESS,
@@ -364,6 +365,7 @@ static int empress_queryctrl(struct file *file, void *priv,
                0
        };
 
+       /* Must be sorted from low to high control ID! */
        static const u32 mpeg_ctrls[] = {
                V4L2_CID_MPEG_CLASS,
                V4L2_CID_MPEG_STREAM_TYPE,
@@ -388,10 +390,10 @@ static int empress_queryctrl(struct file *file, void *priv,
        if (c->id == 0)
                return -EINVAL;
        if (c->id == V4L2_CID_USER_CLASS || c->id == V4L2_CID_MPEG_CLASS)
-               return v4l2_ctrl_query_fill_std(c);
+               return v4l2_ctrl_query_fill(c, 0, 0, 0, 0);
        if (V4L2_CTRL_ID2CLASS(c->id) != V4L2_CTRL_CLASS_MPEG)
                return saa7134_queryctrl(file, priv, c);
-       return saa7134_i2c_call_saa6752(dev, VIDIOC_QUERYCTRL, c);
+       return saa_call_empress(dev, core, queryctrl, c);
 }
 
 static int empress_querymenu(struct file *file, void *priv,
@@ -401,7 +403,7 @@ static int empress_querymenu(struct file *file, void *priv,
 
        if (V4L2_CTRL_ID2CLASS(c->id) != V4L2_CTRL_CLASS_MPEG)
                return -EINVAL;
-       return saa7134_i2c_call_saa6752(dev, VIDIOC_QUERYMENU, c);
+       return saa_call_empress(dev, core, querymenu, c);
 }
 
 static int empress_g_chip_ident(struct file *file, void *fh,
@@ -411,14 +413,11 @@ static int empress_g_chip_ident(struct file *file, void *fh,
 
        chip->ident = V4L2_IDENT_NONE;
        chip->revision = 0;
-       if (dev->mpeg_i2c_client == NULL)
-               return -EINVAL;
        if (chip->match.type == V4L2_CHIP_MATCH_I2C_DRIVER &&
            !strcmp(chip->match.name, "saa6752hs"))
-               return saa7134_i2c_call_saa6752(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
-       if (chip->match.type == V4L2_CHIP_MATCH_I2C_ADDR &&
-           chip->match.addr == dev->mpeg_i2c_client->addr)
-               return saa7134_i2c_call_saa6752(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
+               return saa_call_empress(dev, core, g_chip_ident, chip);
+       if (chip->match.type == V4L2_CHIP_MATCH_I2C_ADDR)
+               return saa_call_empress(dev, core, g_chip_ident, chip);
        return -EINVAL;
 }