aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c7
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c20
2 files changed, 17 insertions, 10 deletions
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 58128687e5c..9bb7bee0da6 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -608,7 +608,10 @@ static int dvb_register(struct cx8802_dev *dev)
if (!fe0)
return -EINVAL;
- /* init frontend */
+ /* multi-frontend gate control is undefined or defaults to fe0 */
+ dev->frontends.gate = 0;
+
+ /* init frontend(s) */
switch (core->boardnr) {
case CX88_BOARD_HAUPPAUGE_DVB_T1:
fe0->dvb.frontend = dvb_attach(cx22702_attach,
@@ -665,6 +668,7 @@ static int dvb_register(struct cx8802_dev *dev)
/* DVB-T init */
fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2);
if (fe1) {
+ dev->frontends.gate = 2;
fe1->dvb.frontend = dvb_attach(cx22702_attach,
&hauppauge_hvr_config,
&dev->core->i2c_adap);
@@ -1008,6 +1012,7 @@ static int dvb_register(struct cx8802_dev *dev)
/* DVB-T Init */
fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2);
if (fe1) {
+ dev->frontends.gate = 2;
fe1->dvb.frontend = dvb_attach(cx22702_attach,
&hauppauge_hvr_config,
&dev->core->i2c_adap);
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index 582769de26b..01de2300709 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -116,23 +116,25 @@ static int detach_inform(struct i2c_client *client)
void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg)
{
- struct videobuf_dvb_frontend *fe0 = NULL;
+ struct videobuf_dvb_frontends *f = &core->dvbdev->frontends;
+ struct videobuf_dvb_frontend *fe = NULL;
if (0 != core->i2c_rc)
return;
#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
- if (core->dvbdev) {
- /* Get the first frontend and assume that all I2C is routed through it */
- /* TODO: Get _THIS_FE_ then find the right i2c_gate_ctrl for it */
- fe0 = videobuf_dvb_get_frontend(&core->dvbdev->frontends, 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 (fe0 && fe0->dvb.frontend && fe0->dvb.frontend->ops.i2c_gate_ctrl)
- fe0->dvb.frontend->ops.i2c_gate_ctrl(fe0->dvb.frontend, 1);
+ 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 (fe0 && fe0->dvb.frontend && fe0->dvb.frontend->ops.i2c_gate_ctrl)
- fe0->dvb.frontend->ops.i2c_gate_ctrl(fe0->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);