From 4d43e13f723e12734257277cc38497fab1efc605 Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Sat, 30 Sep 2006 06:53:48 -0300 Subject: 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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dibusb-mb.c | 198 +++++++++++++++++++--------------- 1 file changed, 112 insertions(+), 86 deletions(-) (limited to 'drivers/media/dvb/dvb-usb/dibusb-mb.c') diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index effd34cc4b0..4fe363e4835 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c @@ -14,35 +14,35 @@ */ #include "dibusb.h" -static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_device *d) +static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_adapter *adap) { struct dib3000_config demod_cfg; - struct dibusb_state *st = d->priv; + struct dibusb_state *st = adap->priv; demod_cfg.demod_address = 0x8; - if ((d->fe = dib3000mb_attach(&demod_cfg,&d->i2c_adap,&st->ops)) == NULL) + if ((adap->fe = dib3000mb_attach(&demod_cfg,&adap->dev->i2c_adap,&st->ops)) == NULL) return -ENODEV; - d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; - d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; + adap->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; + adap->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; - d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; + adap->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; return 0; } -static int dibusb_thomson_tuner_attach(struct dvb_usb_device *d) +static int dibusb_thomson_tuner_attach(struct dvb_usb_adapter *adap) { - d->pll_addr = 0x61; - d->pll_desc = &dvb_pll_tua6010xs; + adap->pll_addr = 0x61; + adap->pll_desc = &dvb_pll_tua6010xs; return 0; } /* Some of the Artec 1.1 device aren't equipped with the default tuner * (Thomson Cable), but with a Panasonic ENV77H11D5. This function figures * this out. */ -static int dibusb_tuner_probe_and_attach(struct dvb_usb_device *d) +static int dibusb_tuner_probe_and_attach(struct dvb_usb_adapter *adap) { u8 b[2] = { 0,0 }, b2[1]; int ret = 0; @@ -54,36 +54,36 @@ static int dibusb_tuner_probe_and_attach(struct dvb_usb_device *d) /* the Panasonic sits on I2C addrass 0x60, the Thomson on 0x61 */ msg[0].addr = msg[1].addr = 0x60; - if (d->tuner_pass_ctrl) - d->tuner_pass_ctrl(d->fe,1,msg[0].addr); + if (adap->tuner_pass_ctrl) + adap->tuner_pass_ctrl(adap->fe,1,msg[0].addr); - if (i2c_transfer (&d->i2c_adap, msg, 2) != 2) { + if (i2c_transfer(&adap->dev->i2c_adap, msg, 2) != 2) { err("tuner i2c write failed."); ret = -EREMOTEIO; } - if (d->tuner_pass_ctrl) - d->tuner_pass_ctrl(d->fe,0,msg[0].addr); + if (adap->tuner_pass_ctrl) + adap->tuner_pass_ctrl(adap->fe,0,msg[0].addr); if (b2[0] == 0xfe) { info("This device has the Thomson Cable onboard. Which is default."); - dibusb_thomson_tuner_attach(d); + dibusb_thomson_tuner_attach(adap); } else { u8 bpll[4] = { 0x0b, 0xf5, 0x85, 0xab }; info("This device has the Panasonic ENV77H11D5 onboard."); - d->pll_addr = 0x60; - memcpy(d->pll_init,bpll,4); - d->pll_desc = &dvb_pll_tda665x; + adap->pll_addr = 0x60; + memcpy(adap->pll_init,bpll,4); + adap->pll_desc = &dvb_pll_tda665x; } return ret; } /* USB Driver stuff */ -static struct dvb_usb_properties dibusb1_1_properties; -static struct dvb_usb_properties dibusb1_1_an2235_properties; -static struct dvb_usb_properties dibusb2_0b_properties; -static struct dvb_usb_properties artec_t1_usb2_properties; +static struct dvb_usb_device_properties dibusb1_1_properties; +static struct dvb_usb_device_properties dibusb1_1_an2235_properties; +static struct dvb_usb_device_properties dibusb2_0b_properties; +static struct dvb_usb_device_properties artec_t1_usb2_properties; static int dibusb_probe(struct usb_interface *intf, const struct usb_device_id *id) @@ -150,34 +150,28 @@ static struct usb_device_id dibusb_dib3000mb_table [] = { }; MODULE_DEVICE_TABLE (usb, dibusb_dib3000mb_table); -static struct dvb_usb_properties dibusb1_1_properties = { - .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, - .pid_filter_count = 16, +static struct dvb_usb_device_properties dibusb1_1_properties = { + .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = CYPRESS_AN2135, .firmware = "dvb-usb-dibusb-5.0.0.11.fw", - .size_of_priv = sizeof(struct dibusb_state), + .num_adapters = 1, + .adapter = { + { + .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, + .pid_filter_count = 16, .streaming_ctrl = dibusb_streaming_ctrl, .pid_filter = dibusb_pid_filter, .pid_filter_ctrl = dibusb_pid_filter_ctrl, - .power_ctrl = dibusb_power_ctrl, .frontend_attach = dibusb_dib3000mb_frontend_attach, .tuner_attach = dibusb_tuner_probe_and_attach, - .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, - .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ - .rc_query = dibusb_rc_query, - - .i2c_algo = &dibusb_i2c_algo, - - .generic_bulk_ctrl_endpoint = 0x01, /* parameter for the MPEG2-data transfer */ - .urb = { - .type = DVB_USB_BULK, + .stream = { + .type = USB_BULK, .count = 7, .endpoint = 0x02, .u = { @@ -186,6 +180,20 @@ static struct dvb_usb_properties dibusb1_1_properties = { } } }, + .size_of_priv = sizeof(struct dibusb_state), + } + }, + + .power_ctrl = dibusb_power_ctrl, + + .rc_interval = DEFAULT_RC_INTERVAL, + .rc_key_map = dibusb_rc_keys, + .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ + .rc_query = dibusb_rc_query, + + .i2c_algo = &dibusb_i2c_algo, + + .generic_bulk_ctrl_endpoint = 0x01, .num_device_descs = 9, .devices = { @@ -228,34 +236,27 @@ static struct dvb_usb_properties dibusb1_1_properties = { } }; -static struct dvb_usb_properties dibusb1_1_an2235_properties = { - .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, - .pid_filter_count = 16, - +static struct dvb_usb_device_properties dibusb1_1_an2235_properties = { + .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = CYPRESS_AN2235, .firmware = "dvb-usb-dibusb-an2235-01.fw", - .size_of_priv = sizeof(struct dibusb_state), + .num_adapters = 1, + .adapter = { + { + .caps = DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_ADAP_HAS_PID_FILTER, + .pid_filter_count = 16, .streaming_ctrl = dibusb_streaming_ctrl, .pid_filter = dibusb_pid_filter, .pid_filter_ctrl = dibusb_pid_filter_ctrl, - .power_ctrl = dibusb_power_ctrl, .frontend_attach = dibusb_dib3000mb_frontend_attach, .tuner_attach = dibusb_tuner_probe_and_attach, - .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, - .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ - .rc_query = dibusb_rc_query, - - .i2c_algo = &dibusb_i2c_algo, - - .generic_bulk_ctrl_endpoint = 0x01, /* parameter for the MPEG2-data transfer */ - .urb = { - .type = DVB_USB_BULK, + .stream = { + .type = USB_BULK, .count = 7, .endpoint = 0x02, .u = { @@ -264,6 +265,19 @@ static struct dvb_usb_properties dibusb1_1_an2235_properties = { } } }, + .size_of_priv = sizeof(struct dibusb_state), + }, + }, + .power_ctrl = dibusb_power_ctrl, + + .rc_interval = DEFAULT_RC_INTERVAL, + .rc_key_map = dibusb_rc_keys, + .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ + .rc_query = dibusb_rc_query, + + .i2c_algo = &dibusb_i2c_algo, + + .generic_bulk_ctrl_endpoint = 0x01, #ifdef CONFIG_DVB_USB_DIBUSB_MB_FAULTY .num_device_descs = 2, @@ -285,34 +299,27 @@ static struct dvb_usb_properties dibusb1_1_an2235_properties = { } }; -static struct dvb_usb_properties dibusb2_0b_properties = { - .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, - .pid_filter_count = 16, +static struct dvb_usb_device_properties dibusb2_0b_properties = { + .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-adstech-usb2-02.fw", - .size_of_priv = sizeof(struct dibusb_state), + .num_adapters = 1, + .adapter = { + { + .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, + .pid_filter_count = 16, .streaming_ctrl = dibusb2_0_streaming_ctrl, .pid_filter = dibusb_pid_filter, .pid_filter_ctrl = dibusb_pid_filter_ctrl, - .power_ctrl = dibusb2_0_power_ctrl, .frontend_attach = dibusb_dib3000mb_frontend_attach, .tuner_attach = dibusb_thomson_tuner_attach, - - .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, - .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ - .rc_query = dibusb_rc_query, - - .i2c_algo = &dibusb_i2c_algo, - - .generic_bulk_ctrl_endpoint = 0x01, /* parameter for the MPEG2-data transfer */ - .urb = { - .type = DVB_USB_BULK, + .stream = { + .type = USB_BULK, .count = 7, .endpoint = 0x06, .u = { @@ -321,6 +328,19 @@ static struct dvb_usb_properties dibusb2_0b_properties = { } } }, + .size_of_priv = sizeof(struct dibusb_state), + } + }, + .power_ctrl = dibusb2_0_power_ctrl, + + .rc_interval = DEFAULT_RC_INTERVAL, + .rc_key_map = dibusb_rc_keys, + .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ + .rc_query = dibusb_rc_query, + + .i2c_algo = &dibusb_i2c_algo, + + .generic_bulk_ctrl_endpoint = 0x01, .num_device_descs = 2, .devices = { @@ -336,34 +356,27 @@ static struct dvb_usb_properties dibusb2_0b_properties = { } }; -static struct dvb_usb_properties artec_t1_usb2_properties = { - .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, - .pid_filter_count = 16, +static struct dvb_usb_device_properties artec_t1_usb2_properties = { + .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-dibusb-6.0.0.8.fw", - .size_of_priv = sizeof(struct dibusb_state), + .num_adapters = 1, + .adapter = { + { + .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, + .pid_filter_count = 16, .streaming_ctrl = dibusb2_0_streaming_ctrl, .pid_filter = dibusb_pid_filter, .pid_filter_ctrl = dibusb_pid_filter_ctrl, - .power_ctrl = dibusb2_0_power_ctrl, .frontend_attach = dibusb_dib3000mb_frontend_attach, .tuner_attach = dibusb_tuner_probe_and_attach, - - .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, - .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ - .rc_query = dibusb_rc_query, - - .i2c_algo = &dibusb_i2c_algo, - - .generic_bulk_ctrl_endpoint = 0x01, /* parameter for the MPEG2-data transfer */ - .urb = { - .type = DVB_USB_BULK, + .stream = { + .type = USB_BULK, .count = 7, .endpoint = 0x06, .u = { @@ -372,6 +385,19 @@ static struct dvb_usb_properties artec_t1_usb2_properties = { } } }, + .size_of_priv = sizeof(struct dibusb_state), + } + }, + .power_ctrl = dibusb2_0_power_ctrl, + + .rc_interval = DEFAULT_RC_INTERVAL, + .rc_key_map = dibusb_rc_keys, + .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ + .rc_query = dibusb_rc_query, + + .i2c_algo = &dibusb_i2c_algo, + + .generic_bulk_ctrl_endpoint = 0x01, .num_device_descs = 1, .devices = { -- cgit v1.2.3