V4L/DVB (10247): saa7134: convert to the new v4l2 framework.
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 17 Jan 2009 15:17:14 +0000 (12:17 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:22 +0000 (12:42 -0300)
Register v4l2_device and switch to v4l2_subdev to access the i2c modules.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/saa7134/saa6752hs.c
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa7134/saa7134-dvb.c
drivers/media/video/saa7134/saa7134-empress.c
drivers/media/video/saa7134/saa7134-i2c.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/saa7134/saa7134.h

index 25e6ab28a0a30c3628f94136bc651f00b0d3e8f9..2d292ad776e9fa7252d25931c573842afbaeb431 100644 (file)
@@ -36,7 +36,7 @@
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-chip-ident.h>
-#include <media/v4l2-i2c-drv-legacy.h>
+#include <media/v4l2-i2c-drv.h>
 #include <linux/init.h>
 #include <linux/crc32.h>
 
 #define MPEG_TOTAL_TARGET_BITRATE_MAX  27000
 #define MPEG_PID_MAX ((1 << 14) - 1)
 
-/* Addresses to scan */
-static unsigned short normal_i2c[] = {0x20, I2C_CLIENT_END};
-
-I2C_CLIENT_INSMOD;
 
 MODULE_DESCRIPTION("device driver for saa6752hs MPEG2 encoder");
 MODULE_AUTHOR("Andrew de Quincey");
@@ -914,11 +910,6 @@ static int saa6752hs_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_i
                        chip, h->chip, h->revision);
 }
 
-static int saa6752hs_command(struct i2c_client *client, unsigned cmd, void *arg)
-{
-       return v4l2_subdev_command(i2c_get_clientdata(client), cmd, arg);
-}
-
 /* ----------------------------------------------------------------------- */
 
 static const struct v4l2_subdev_core_ops saa6752hs_core_ops = {
@@ -993,8 +984,6 @@ MODULE_DEVICE_TABLE(i2c, saa6752hs_id);
 
 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
        .name = "saa6752hs",
-       .driverid = I2C_DRIVERID_SAA6752HS,
-       .command = saa6752hs_command,
        .probe = saa6752hs_probe,
        .remove = saa6752hs_remove,
        .id_table = saa6752hs_id,
index e2febcd6e529f45245bbd02c6c7e684ca9e14fe5..0d50d7448fc5d9076914b7ebcc64e77420f25e19 100644 (file)
@@ -4611,7 +4611,7 @@ struct saa7134_board saa7134_boards[] = {
                .tuner_type     = TUNER_YMEC_TVF_5533MF,
                .radio_type     = TUNER_TEA5767,
                .tuner_addr     = ADDR_UNSET,
-               .radio_addr     = ADDR_UNSET,
+               .radio_addr     = 0x60,
                .gpiomask       = 0x80000700,
                .inputs = { {
                        .name   = name_tv,
@@ -6109,7 +6109,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
 
                tun_setup.mode_mask = T_RADIO;
 
-               saa7134_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
+               saa_call_all(dev, tuner, s_type_addr, &tun_setup);
                mode_mask &= ~T_RADIO;
        }
 
@@ -6121,7 +6121,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
 
                tun_setup.mode_mask = mode_mask;
 
-               saa7134_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
+               saa_call_all(dev, tuner, s_type_addr, &tun_setup);
        }
 
        if (dev->tda9887_conf) {
@@ -6130,8 +6130,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
                tda9887_cfg.tuner = TUNER_TDA9887;
                tda9887_cfg.priv = &dev->tda9887_conf;
 
-               saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG,
-                                        &tda9887_cfg);
+               saa_call_all(dev, tuner, s_config, &tda9887_cfg);
        }
 
        if (dev->tuner_type == TUNER_XC2028) {
@@ -6158,7 +6157,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
                xc2028_cfg.tuner = TUNER_XC2028;
                xc2028_cfg.priv  = &ctl;
 
-               saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg);
+               saa_call_all(dev, tuner, s_config, &xc2028_cfg);
        }
 }
 
@@ -6401,7 +6400,7 @@ int saa7134_board_init2(struct saa7134_dev *dev)
                ctl.xtal_freq = TEA5767_HIGH_LO_13MHz;
                tea5767_cfg.tuner = TUNER_TEA5767;
                tea5767_cfg.priv  = &ctl;
-               saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tea5767_cfg);
+               saa_call_all(dev, tuner, s_config, &tea5767_cfg);
                break;
        }
        } /* switch() */
index 99221d726edb373603c6d75789459b3209b03b9b..ac23ff53543d7629d7952db9ede57bd5ce6b2199 100644 (file)
@@ -851,6 +851,10 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
        if (NULL == dev)
                return -ENOMEM;
 
+       err = v4l2_device_register(&pci_dev->dev, &dev->v4l2_dev);
+       if (err)
+               goto fail0;
+
        /* pci init */
        dev->pci = pci_dev;
        if (pci_enable_device(pci_dev)) {
@@ -927,6 +931,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
        dev->autodetected = card[dev->nr] != dev->board;
        dev->tuner_type = saa7134_boards[dev->board].tuner_type;
        dev->tuner_addr = saa7134_boards[dev->board].tuner_addr;
+       dev->radio_type = saa7134_boards[dev->board].radio_type;
+       dev->radio_addr = saa7134_boards[dev->board].radio_addr;
        dev->tda9887_conf = saa7134_boards[dev->board].tda9887_conf;
        if (UNSET != tuner[dev->nr])
                dev->tuner_type = tuner[dev->nr];
@@ -973,15 +979,50 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
        saa7134_i2c_register(dev);
 
        /* initialize hardware #2 */
-       if (TUNER_ABSENT != dev->tuner_type)
-               request_module("tuner");
+       if (TUNER_ABSENT != dev->tuner_type) {
+               if (dev->radio_type != UNSET) {
+                       v4l2_i2c_new_subdev(&dev->i2c_adap, "tuner", "tuner",
+                                       dev->radio_addr);
+               }
+               if (dev->tda9887_conf & TDA9887_PRESENT) {
+                       unsigned short addrs[] = { 0x42, 0x43, 0x4a, 0x4b,
+                                                  I2C_CLIENT_END };
+
+                       v4l2_i2c_new_probed_subdev(&dev->i2c_adap,
+                                       "tuner", "tuner", addrs);
+               }
+               if (dev->tuner_addr != ADDR_UNSET) {
+                       v4l2_i2c_new_subdev(&dev->i2c_adap,
+                                       "tuner", "tuner", dev->tuner_addr);
+               } else {
+                       unsigned short addrs[] = {
+                               0x42, 0x43, 0x4a, 0x4b,         /* tda8290 */
+                               0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+                               0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+                               I2C_CLIENT_END
+                       };
+
+                       if (dev->tda9887_conf & TDA9887_PRESENT) {
+                               v4l2_i2c_new_probed_subdev(&dev->i2c_adap,
+                                               "tuner", "tuner", addrs + 4);
+                       } else {
+                               v4l2_i2c_new_probed_subdev(&dev->i2c_adap,
+                                               "tuner", "tuner", addrs);
+                       }
+               }
+       }
        saa7134_board_init2(dev);
 
        saa7134_hwinit2(dev);
 
        /* load i2c helpers */
        if (card_is_empress(dev)) {
-               request_module("saa6752hs");
+               struct v4l2_subdev *sd =
+                       v4l2_i2c_new_subdev(&dev->i2c_adap, "saa6752hs",
+                               "saa6752hs", 0x20);
+
+               if (sd)
+                       sd->grp_id = GRP_EMPRESS;
        }
 
        request_submodules(dev);
@@ -1023,7 +1064,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
        }
 
        /* everything worked */
-       pci_set_drvdata(pci_dev,dev);
        saa7134_devcount++;
 
        mutex_lock(&devlist_lock);
@@ -1040,7 +1080,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
        }
 
        if (TUNER_ABSENT != dev->tuner_type)
-               saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL);
+               saa_call_all(dev, core, s_standby, 0);
 
        return 0;
 
@@ -1055,13 +1095,16 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
        release_mem_region(pci_resource_start(pci_dev,0),
                           pci_resource_len(pci_dev,0));
  fail1:
+       v4l2_device_unregister(&dev->v4l2_dev);
+ fail0:
        kfree(dev);
        return err;
 }
 
 static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
 {
-       struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
+       struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
+       struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev);
        struct saa7134_mpeg_ops *mops;
 
        /* Release DMA sound modules if present */
@@ -1113,7 +1156,8 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
        release_mem_region(pci_resource_start(pci_dev,0),
                           pci_resource_len(pci_dev,0));
 
-       pci_set_drvdata(pci_dev, NULL);
+
+       v4l2_device_unregister(&dev->v4l2_dev);
 
        /* free memory */
        kfree(dev);
@@ -1148,8 +1192,8 @@ static int saa7134_buffer_requeue(struct saa7134_dev *dev,
 
 static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state)
 {
-
-       struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
+       struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
+       struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev);
 
        /* disable overlay - apps should enable it explicitly on resume*/
        dev->ovenable = 0;
@@ -1185,7 +1229,8 @@ static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state)
 
 static int saa7134_resume(struct pci_dev *pci_dev)
 {
-       struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
+       struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
+       struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev);
        unsigned long flags;
 
        pci_set_power_state(pci_dev, PCI_D0);
@@ -1307,7 +1352,6 @@ module_exit(saa7134_fini);
 /* ----------------------------------------------------------- */
 
 EXPORT_SYMBOL(saa7134_set_gpio);
-EXPORT_SYMBOL(saa7134_i2c_call_clients);
 EXPORT_SYMBOL(saa7134_devlist);
 EXPORT_SYMBOL(saa7134_boards);
 
index b5370b3e1a3dab2e3b969d99664c2f830ecfb94e..af9a22d1b94d6691e235c6799d0022e92f95c176 100644 (file)
@@ -189,7 +189,7 @@ static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe,
        if (fe->ops.i2c_gate_ctrl)
                fe->ops.i2c_gate_ctrl(fe, 1);
        i2c_transfer(&dev->i2c_adap, &msg, 1);
-       saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f);
+       saa_call_all(dev, tuner, s_frequency, &f);
        msg.buf = on;
        if (fe->ops.i2c_gate_ctrl)
                fe->ops.i2c_gate_ctrl(fe, 1);
@@ -1449,7 +1449,7 @@ static int dvb_fini(struct saa7134_dev *dev)
                tda9887_cfg.priv  = &on;
 
                /* otherwise we don't detect the tuner on next insmod */
-               saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tda9887_cfg);
+               saa_call_all(dev, tuner, s_config, &tda9887_cfg);
        } else if (dev->board == SAA7134_BOARD_MEDION_MD8800_QUADRO) {
                if ((dev->eedata[2] == 0x07) && use_frontend) {
                        /* turn off the 2nd lnb supply */
index c9d8beb87a608114c30ce64577a440afb788847c..d9d9607044a7c58379a279a52bf352a6882820a8 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,
@@ -391,7 +391,7 @@ static int empress_queryctrl(struct file *file, void *priv,
                return v4l2_ctrl_query_fill_std(c);
        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 +401,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 +411,12 @@ 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);
+               return saa_call_empress(dev, core, 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);
+           chip->match.addr == 0x20)
+               return saa_call_empress(dev, core, g_chip_ident, chip);
        return -EINVAL;
 }
 
index 20c1b33caf7b64bbd551a929db1f2a52bbf3da32..2e15f43d26ecd238fa7d106f0d9c9618d4f9e051 100644 (file)
@@ -327,8 +327,6 @@ static int attach_inform(struct i2c_client *client)
 
        d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
                client->driver->driver.name, client->addr, client->name);
-       if (client->addr == 0x20 && client->driver && client->driver->command)
-               dev->mpeg_i2c_client = client;
 
        /* Am I an i2c remote control? */
 
@@ -357,7 +355,6 @@ static struct i2c_algorithm saa7134_algo = {
 
 static struct i2c_adapter saa7134_adap_template = {
        .owner         = THIS_MODULE,
-       .class         = I2C_CLASS_TV_ANALOG,
        .name          = "saa7134",
        .id            = I2C_HW_SAA7134,
        .algo          = &saa7134_algo,
@@ -421,29 +418,13 @@ static void do_i2c_scan(char *name, struct i2c_client *c)
        }
 }
 
-void saa7134_i2c_call_clients(struct saa7134_dev *dev,
-                             unsigned int cmd, void *arg)
-{
-       BUG_ON(NULL == dev->i2c_adap.algo_data);
-       i2c_clients_command(&dev->i2c_adap, cmd, arg);
-}
-
-int saa7134_i2c_call_saa6752(struct saa7134_dev *dev,
-                                             unsigned int cmd, void *arg)
-{
-       if (dev->mpeg_i2c_client == NULL)
-               return -EINVAL;
-       return dev->mpeg_i2c_client->driver->command(dev->mpeg_i2c_client,
-                                                               cmd, arg);
-}
-EXPORT_SYMBOL_GPL(saa7134_i2c_call_saa6752);
-
 int saa7134_i2c_register(struct saa7134_dev *dev)
 {
        dev->i2c_adap = saa7134_adap_template;
        dev->i2c_adap.dev.parent = &dev->pci->dev;
        strcpy(dev->i2c_adap.name,dev->name);
        dev->i2c_adap.algo_data = dev;
+       i2c_set_adapdata(&dev->i2c_adap, &dev->v4l2_dev);
        i2c_add_adapter(&dev->i2c_adap);
 
        dev->i2c_client = saa7134_client_template;
index a1f7e351f57234480719c0b297c38ccbf7583cb1..193b07d83d1eaa4c96b481ab537cf0c5f0b56062 100644 (file)
@@ -627,10 +627,10 @@ void saa7134_set_tvnorm_hw(struct saa7134_dev *dev)
        saa7134_set_decoder(dev);
 
        if (card_in(dev, dev->ctl_input).tv)
-               saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id);
+               saa_call_all(dev, tuner, s_std, dev->tvnorm->id);
        /* Set the correct norm for the saa6752hs. This function
           does nothing if there is no saa6752hs. */
-       saa7134_i2c_call_saa6752(dev, VIDIOC_S_STD, &dev->tvnorm->id);
+       saa_call_empress(dev, tuner, s_std, dev->tvnorm->id);
 }
 
 static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale)
@@ -1266,8 +1266,7 @@ int saa7134_s_ctrl_internal(struct saa7134_dev *dev,  struct saa7134_fh *fh, str
                        else
                                dev->tda9887_conf &= ~TDA9887_AUTOMUTE;
 
-                       saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG,
-                                                &tda9887_cfg);
+                       saa_call_all(dev, tuner, s_config, &tda9887_cfg);
                }
                break;
        }
@@ -1387,7 +1386,7 @@ static int video_open(struct file *file)
        if (fh->radio) {
                /* switch to radio mode */
                saa7134_tvaudio_setinput(dev,&card(dev).radio);
-               saa7134_i2c_call_clients(dev,AUDC_SET_RADIO, NULL);
+               saa_call_all(dev, tuner, s_radio);
        } else {
                /* switch to video/vbi mode */
                video_mux(dev,dev->ctl_input);
@@ -1498,7 +1497,7 @@ static int video_release(struct file *file)
        saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0);
        saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0);
 
-       saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL);
+       saa_call_all(dev, core, s_standby, 0);
 
        /* free stuff */
        videobuf_mmap_free(&fh->cap);
@@ -2041,7 +2040,7 @@ static int saa7134_s_frequency(struct file *file, void *priv,
        mutex_lock(&dev->lock);
        dev->ctl_freq = f->frequency;
 
-       saa7134_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, f);
+       saa_call_all(dev, tuner, s_frequency, f);
 
        saa7134_tvaudio_do_scan(dev);
        mutex_unlock(&dev->lock);
@@ -2299,7 +2298,7 @@ static int radio_g_tuner(struct file *file, void *priv,
        strcpy(t->name, "Radio");
        t->type = V4L2_TUNER_RADIO;
 
-       saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t);
+       saa_call_all(dev, tuner, g_tuner, t);
        if (dev->input->amux == TV) {
                t->signal = 0xf800 - ((saa_readb(0x581) & 0x1f) << 11);
                t->rxsubchans = (saa_readb(0x529) & 0x08) ?
@@ -2316,7 +2315,7 @@ static int radio_s_tuner(struct file *file, void *priv,
        if (0 != t->index)
                return -EINVAL;
 
-       saa7134_i2c_call_clients(dev, VIDIOC_S_TUNER, t);
+       saa_call_all(dev, tuner, s_tuner, t);
        return 0;
 }
 
index 14ee265f33747b3f9583f8e51d78b917189dfd97..bb6952118d0134fce6713170707be421be92d18c 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <media/v4l2-common.h>
 #include <media/v4l2-ioctl.h>
+#include <media/v4l2-device.h>
 #include <media/tuner.h>
 #include <media/ir-common.h>
 #include <media/ir-kbd-i2c.h>
@@ -482,6 +483,7 @@ struct saa7134_dev {
        struct mutex               lock;
        spinlock_t                 slock;
        struct v4l2_prio_state     prio;
+       struct v4l2_device         v4l2_dev;
        /* workstruct for loading modules */
        struct work_struct request_module_wk;
 
@@ -572,7 +574,6 @@ struct saa7134_dev {
        enum saa7134_ts_status     ts_state;
        unsigned int               buff_cnt;
        struct saa7134_mpeg_ops    *mops;
-       struct i2c_client          *mpeg_i2c_client;
 
        /* SAA7134_MPEG_EMPRESS only */
        struct video_device        *empress_dev;
@@ -616,6 +617,12 @@ struct saa7134_dev {
                V4L2_STD_NTSC   | V4L2_STD_PAL_M | \
                V4L2_STD_PAL_60)
 
+#define GRP_EMPRESS (1)
+#define saa_call_all(dev, o, f, args...) \
+       v4l2_device_call_all(&(dev)->v4l2_dev, 0, o, f , ##args)
+#define saa_call_empress(dev, o, f, args...) \
+       v4l2_device_call_until_err(&(dev)->v4l2_dev, GRP_EMPRESS, o, f , ##args)
+
 /* ----------------------------------------------------------- */
 /* saa7134-core.c                                              */
 
@@ -668,10 +675,6 @@ int saa7134_tuner_callback(void *priv, int component, int command, int arg);
 
 int saa7134_i2c_register(struct saa7134_dev *dev);
 int saa7134_i2c_unregister(struct saa7134_dev *dev);
-void saa7134_i2c_call_clients(struct saa7134_dev *dev,
-                             unsigned int cmd, void *arg);
-int saa7134_i2c_call_saa6752(struct saa7134_dev *dev,
-                             unsigned int cmd, void *arg);
 
 
 /* ----------------------------------------------------------- */