aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/dibusb-common.c
diff options
context:
space:
mode:
authorPatrick Boettcher <pb@linuxtv.org>2006-09-30 05:53:48 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-10-03 14:10:54 -0400
commit4d43e13f723e12734257277cc38497fab1efc605 (patch)
tree7debc4f9b7997f7d768dcf387210436b532198f4 /drivers/media/dvb/dvb-usb/dibusb-common.c
parent8ccb3dcd1f8e80e8702642e1de26541b52f6bb7c (diff)
V4L/DVB (4643): Multi-input patch for DVB-USB device
This patch is the first commit of the Multiple Input Patch for the DVB-USB frame work. It changes the DVB-USB-device to be able to have more than one streaming input (e.g. multiple DVB-T sources) on one device. This is a necessary feature for the upcoming DiB7700 driven devices. Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dibusb-common.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-common.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c
index 124e25ac53b3..5f8afec96a3b 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-common.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-common.c
@@ -18,12 +18,12 @@ MODULE_LICENSE("GPL");
18#define deb_info(args...) dprintk(debug,0x01,args) 18#define deb_info(args...) dprintk(debug,0x01,args)
19 19
20/* common stuff used by the different dibusb modules */ 20/* common stuff used by the different dibusb modules */
21int dibusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) 21int dibusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
22{ 22{
23 if (d->priv != NULL) { 23 if (adap->priv != NULL) {
24 struct dibusb_state *st = d->priv; 24 struct dibusb_state *st = adap->priv;
25 if (st->ops.fifo_ctrl != NULL) 25 if (st->ops.fifo_ctrl != NULL)
26 if (st->ops.fifo_ctrl(d->fe,onoff)) { 26 if (st->ops.fifo_ctrl(adap->fe,onoff)) {
27 err("error while controlling the fifo of the demod."); 27 err("error while controlling the fifo of the demod.");
28 return -ENODEV; 28 return -ENODEV;
29 } 29 }
@@ -32,23 +32,23 @@ int dibusb_streaming_ctrl(struct dvb_usb_device *d, int onoff)
32} 32}
33EXPORT_SYMBOL(dibusb_streaming_ctrl); 33EXPORT_SYMBOL(dibusb_streaming_ctrl);
34 34
35int dibusb_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) 35int dibusb_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
36{ 36{
37 if (d->priv != NULL) { 37 if (adap->priv != NULL) {
38 struct dibusb_state *st = d->priv; 38 struct dibusb_state *st = adap->priv;
39 if (st->ops.pid_ctrl != NULL) 39 if (st->ops.pid_ctrl != NULL)
40 st->ops.pid_ctrl(d->fe,index,pid,onoff); 40 st->ops.pid_ctrl(adap->fe,index,pid,onoff);
41 } 41 }
42 return 0; 42 return 0;
43} 43}
44EXPORT_SYMBOL(dibusb_pid_filter); 44EXPORT_SYMBOL(dibusb_pid_filter);
45 45
46int dibusb_pid_filter_ctrl(struct dvb_usb_device *d, int onoff) 46int dibusb_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
47{ 47{
48 if (d->priv != NULL) { 48 if (adap->priv != NULL) {
49 struct dibusb_state *st = d->priv; 49 struct dibusb_state *st = adap->priv;
50 if (st->ops.pid_parse != NULL) 50 if (st->ops.pid_parse != NULL)
51 if (st->ops.pid_parse(d->fe,onoff) < 0) 51 if (st->ops.pid_parse(adap->fe,onoff) < 0)
52 err("could not handle pid_parser"); 52 err("could not handle pid_parser");
53 } 53 }
54 return 0; 54 return 0;
@@ -68,24 +68,24 @@ int dibusb_power_ctrl(struct dvb_usb_device *d, int onoff)
68} 68}
69EXPORT_SYMBOL(dibusb_power_ctrl); 69EXPORT_SYMBOL(dibusb_power_ctrl);
70 70
71int dibusb2_0_streaming_ctrl(struct dvb_usb_device *d, int onoff) 71int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
72{ 72{
73 u8 b[3] = { 0 }; 73 u8 b[3] = { 0 };
74 int ret; 74 int ret;
75 75
76 if ((ret = dibusb_streaming_ctrl(d,onoff)) < 0) 76 if ((ret = dibusb_streaming_ctrl(adap,onoff)) < 0)
77 return ret; 77 return ret;
78 78
79 if (onoff) { 79 if (onoff) {
80 b[0] = DIBUSB_REQ_SET_STREAMING_MODE; 80 b[0] = DIBUSB_REQ_SET_STREAMING_MODE;
81 b[1] = 0x00; 81 b[1] = 0x00;
82 if ((ret = dvb_usb_generic_write(d,b,2)) < 0) 82 if ((ret = dvb_usb_generic_write(adap->dev,b,2)) < 0)
83 return ret; 83 return ret;
84 } 84 }
85 85
86 b[0] = DIBUSB_REQ_SET_IOCTL; 86 b[0] = DIBUSB_REQ_SET_IOCTL;
87 b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM; 87 b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM;
88 return dvb_usb_generic_write(d,b,3); 88 return dvb_usb_generic_write(adap->dev,b,3);
89} 89}
90EXPORT_SYMBOL(dibusb2_0_streaming_ctrl); 90EXPORT_SYMBOL(dibusb2_0_streaming_ctrl);
91 91
@@ -228,12 +228,12 @@ static struct dib3000mc_config mod3000p_dib3000p_config = {
228 .output_mpeg2_in_188_bytes = 1, 228 .output_mpeg2_in_188_bytes = 1,
229}; 229};
230 230
231int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) 231int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap)
232{ 232{
233 if (dib3000mc_attach(&d->i2c_adap, 1, DEFAULT_DIB3000P_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &d->fe) == 0 || 233 if (dib3000mc_attach(&adap->dev->i2c_adap, 1, DEFAULT_DIB3000P_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &adap->fe) == 0 ||
234 dib3000mc_attach(&d->i2c_adap, 1, DEFAULT_DIB3000MC_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &d->fe) == 0) { 234 dib3000mc_attach(&adap->dev->i2c_adap, 1, DEFAULT_DIB3000MC_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &adap->fe) == 0) {
235 if (d->priv != NULL) { 235 if (adap->priv != NULL) {
236 struct dibusb_state *st = d->priv; 236 struct dibusb_state *st = adap->priv;
237 st->ops.pid_parse = dib3000mc_pid_parse; 237 st->ops.pid_parse = dib3000mc_pid_parse;
238 st->ops.pid_ctrl = dib3000mc_pid_control; 238 st->ops.pid_ctrl = dib3000mc_pid_control;
239 } 239 }
@@ -247,20 +247,20 @@ static struct mt2060_config stk3000p_mt2060_config = {
247 0x60 247 0x60
248}; 248};
249 249
250int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) 250int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *adap)
251{ 251{
252 struct dibusb_state *st = d->priv; 252 struct dibusb_state *st = adap->priv;
253 int ret; 253 int ret;
254 u8 a,b; 254 u8 a,b;
255 u16 if1 = 1220; 255 u16 if1 = 1220;
256 struct i2c_adapter *tun_i2c; 256 struct i2c_adapter *tun_i2c;
257 257
258 // First IF calibration for Liteon Sticks 258 // First IF calibration for Liteon Sticks
259 if (d->udev->descriptor.idVendor == USB_VID_LITEON && 259 if (adap->dev->udev->descriptor.idVendor == USB_VID_LITEON &&
260 d->udev->descriptor.idProduct == USB_PID_LITEON_DVB_T_WARM) { 260 adap->dev->udev->descriptor.idProduct == USB_PID_LITEON_DVB_T_WARM) {
261 261
262 dibusb_read_eeprom_byte(d,0x7E,&a); 262 dibusb_read_eeprom_byte(adap->dev,0x7E,&a);
263 dibusb_read_eeprom_byte(d,0x7F,&b); 263 dibusb_read_eeprom_byte(adap->dev,0x7F,&b);
264 264
265 if (a == 0x00) 265 if (a == 0x00)
266 if1 += b; 266 if1 += b;
@@ -269,14 +269,14 @@ int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d)
269 else 269 else
270 warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a, b); 270 warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a, b);
271 271
272 } else if (d->udev->descriptor.idVendor == USB_VID_DIBCOM && 272 } else if (adap->dev->udev->descriptor.idVendor == USB_VID_DIBCOM &&
273 d->udev->descriptor.idProduct == USB_PID_DIBCOM_MOD3001_WARM) { 273 adap->dev->udev->descriptor.idProduct == USB_PID_DIBCOM_MOD3001_WARM) {
274 u8 desc; 274 u8 desc;
275 dibusb_read_eeprom_byte(d, 7, &desc); 275 dibusb_read_eeprom_byte(adap->dev, 7, &desc);
276 if (desc == 2) { 276 if (desc == 2) {
277 a = 127; 277 a = 127;
278 do { 278 do {
279 dibusb_read_eeprom_byte(d, a, &desc); 279 dibusb_read_eeprom_byte(adap->dev, a, &desc);
280 a--; 280 a--;
281 } while (a > 7 && (desc == 0xff || desc == 0x00)); 281 } while (a > 7 && (desc == 0xff || desc == 0x00));
282 if (desc & 0x80) 282 if (desc & 0x80)
@@ -286,15 +286,15 @@ int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d)
286 } 286 }
287 } 287 }
288 288
289 tun_i2c = dib3000mc_get_tuner_i2c_master(d->fe, 1); 289 tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
290 if ((ret = mt2060_attach(d->fe, tun_i2c, &stk3000p_mt2060_config, if1)) != 0) { 290 if ((ret = mt2060_attach(adap->fe, tun_i2c, &stk3000p_mt2060_config, if1)) != 0) {
291 /* not found - use panasonic pll parameters */ 291 /* not found - use panasonic pll parameters */
292 if (dvb_pll_attach(d->fe, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL) 292 if (dvb_pll_attach(adap->fe, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL)
293 return -ENOMEM; 293 return -ENOMEM;
294 } else { 294 } else {
295 st->mt2060_present = 1; 295 st->mt2060_present = 1;
296 /* set the correct parameters for the dib3000p */ 296 /* set the correct parameters for the dib3000p */
297 dib3000mc_set_config(d->fe, &stk3000p_dib3000p_config); 297 dib3000mc_set_config(adap->fe, &stk3000p_dib3000p_config);
298 } 298 }
299 return 0; 299 return 0;
300} 300}