]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/cx88/cx88-i2c.c
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
[linux-2.6-omap-h63xx.git] / drivers / media / video / cx88 / cx88-i2c.c
index 8e74d64fdcd2e5324e38af6db7002341154e3d8d..1ab691d2069268dc6d2db42ac0b304eef1f69288 100644 (file)
@@ -116,18 +116,27 @@ static int detach_inform(struct i2c_client *client)
 
 void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg)
 {
+#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
+       struct videobuf_dvb_frontends *f = &core->dvbdev->frontends;
+       struct videobuf_dvb_frontend *fe = NULL;
+#endif
        if (0 != core->i2c_rc)
                return;
 
 #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
-       if ( (core->dvbdev) && (core->dvbdev->dvb.frontend) ) {
-               if (core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl)
-                       core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl(core->dvbdev->dvb.frontend, 1);
+       if (core->dvbdev && f) {
+               if(f->gate <= 1) /* undefined or fe0 */
+                       fe = videobuf_dvb_get_frontend(f, 1);
+               else
+                       fe = videobuf_dvb_get_frontend(f, f->gate);
+
+               if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl)
+                       fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 1);
 
                i2c_clients_command(&core->i2c_adap, cmd, arg);
 
-               if (core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl)
-                       core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl(core->dvbdev->dvb.frontend, 0);
+               if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl)
+                       fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 0);
        } else
 #endif
                i2c_clients_command(&core->i2c_adap, cmd, arg);