diff options
-rw-r--r-- | drivers/media/video/cx88/cx88-dvb.c | 7 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-i2c.c | 20 | ||||
-rw-r--r-- | include/media/videobuf-dvb.h | 1 |
3 files changed, 18 insertions, 10 deletions
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 58128687e5cc..9bb7bee0da6d 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) | |||
608 | if (!fe0) | 608 | if (!fe0) |
609 | return -EINVAL; | 609 | return -EINVAL; |
610 | 610 | ||
611 | /* init frontend */ | 611 | /* multi-frontend gate control is undefined or defaults to fe0 */ |
612 | dev->frontends.gate = 0; | ||
613 | |||
614 | /* init frontend(s) */ | ||
612 | switch (core->boardnr) { | 615 | switch (core->boardnr) { |
613 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 616 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
614 | fe0->dvb.frontend = dvb_attach(cx22702_attach, | 617 | fe0->dvb.frontend = dvb_attach(cx22702_attach, |
@@ -665,6 +668,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
665 | /* DVB-T init */ | 668 | /* DVB-T init */ |
666 | fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); | 669 | fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); |
667 | if (fe1) { | 670 | if (fe1) { |
671 | dev->frontends.gate = 2; | ||
668 | fe1->dvb.frontend = dvb_attach(cx22702_attach, | 672 | fe1->dvb.frontend = dvb_attach(cx22702_attach, |
669 | &hauppauge_hvr_config, | 673 | &hauppauge_hvr_config, |
670 | &dev->core->i2c_adap); | 674 | &dev->core->i2c_adap); |
@@ -1008,6 +1012,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
1008 | /* DVB-T Init */ | 1012 | /* DVB-T Init */ |
1009 | fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); | 1013 | fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); |
1010 | if (fe1) { | 1014 | if (fe1) { |
1015 | dev->frontends.gate = 2; | ||
1011 | fe1->dvb.frontend = dvb_attach(cx22702_attach, | 1016 | fe1->dvb.frontend = dvb_attach(cx22702_attach, |
1012 | &hauppauge_hvr_config, | 1017 | &hauppauge_hvr_config, |
1013 | &dev->core->i2c_adap); | 1018 | &dev->core->i2c_adap); |
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 582769de26b5..01de23007095 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) | |||
116 | 116 | ||
117 | void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg) | 117 | void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg) |
118 | { | 118 | { |
119 | struct videobuf_dvb_frontend *fe0 = NULL; | 119 | struct videobuf_dvb_frontends *f = &core->dvbdev->frontends; |
120 | struct videobuf_dvb_frontend *fe = NULL; | ||
120 | if (0 != core->i2c_rc) | 121 | if (0 != core->i2c_rc) |
121 | return; | 122 | return; |
122 | 123 | ||
123 | #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) | 124 | #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) |
124 | if (core->dvbdev) { | 125 | if (core->dvbdev && f) { |
125 | /* Get the first frontend and assume that all I2C is routed through it */ | 126 | if(f->gate <= 1) /* undefined or fe0 */ |
126 | /* TODO: Get _THIS_FE_ then find the right i2c_gate_ctrl for it */ | 127 | fe = videobuf_dvb_get_frontend(f, 1); |
127 | fe0 = videobuf_dvb_get_frontend(&core->dvbdev->frontends, 1); | 128 | else |
129 | fe = videobuf_dvb_get_frontend(f, f->gate); | ||
128 | 130 | ||
129 | if (fe0 && fe0->dvb.frontend && fe0->dvb.frontend->ops.i2c_gate_ctrl) | 131 | if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl) |
130 | fe0->dvb.frontend->ops.i2c_gate_ctrl(fe0->dvb.frontend, 1); | 132 | fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 1); |
131 | 133 | ||
132 | i2c_clients_command(&core->i2c_adap, cmd, arg); | 134 | i2c_clients_command(&core->i2c_adap, cmd, arg); |
133 | 135 | ||
134 | if (fe0 && fe0->dvb.frontend && fe0->dvb.frontend->ops.i2c_gate_ctrl) | 136 | if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl) |
135 | fe0->dvb.frontend->ops.i2c_gate_ctrl(fe0->dvb.frontend, 0); | 137 | fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 0); |
136 | } else | 138 | } else |
137 | #endif | 139 | #endif |
138 | i2c_clients_command(&core->i2c_adap, cmd, arg); | 140 | i2c_clients_command(&core->i2c_adap, cmd, arg); |
diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h index 09547ec3f3c3..47bc2c5e7ba9 100644 --- a/include/media/videobuf-dvb.h +++ b/include/media/videobuf-dvb.h | |||
@@ -36,6 +36,7 @@ struct videobuf_dvb_frontends { | |||
36 | struct dvb_adapter adapter; | 36 | struct dvb_adapter adapter; |
37 | int active_fe_id; /* Indicates which frontend in the felist is in use */ | 37 | int active_fe_id; /* Indicates which frontend in the felist is in use */ |
38 | struct videobuf_dvb_frontend frontend; | 38 | struct videobuf_dvb_frontend frontend; |
39 | int gate; /* Frontend with gate control 0=!MFE,1=fe0,2=fe1 etc */ | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, | 42 | int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, |