diff options
author | Patrick Boettcher | 2006-09-19 12:51:40 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab | 2006-10-03 15:12:36 -0300 |
commit | 6958effedb0dc709966c22e7fd0e8210b5401b84 (patch) | |
tree | e9a0d9768b1a5e53c6667309d946cb6c3204e3c0 /drivers/media/dvb | |
parent | b7f54910ce018f93a74211136be46c09cefd80e2 (diff) |
V4L/DVB (4648): Hauppauge Nova-T 500 support added
This changeset finalizes the support of the Hauppauge Nova-T 500 (Dual DVB-T).
It adds correct AGC setting for the 3000P, correct firmware download state
detection.
Additionally it fixes the mt2060-driver to be able to be used with dvb_attach.
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dib0700.h | 4 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dib0700_core.c | 21 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dib0700_devices.c | 38 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-firmware.c | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 4 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mc.c | 1 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/mt2060.c | 10 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/mt2060.h | 2 |
8 files changed, 54 insertions, 27 deletions
diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h index a2cd6970f4c2..ac84347f9d4c 100644 --- a/drivers/media/dvb/dvb-usb/dib0700.h +++ b/drivers/media/dvb/dvb-usb/dib0700.h @@ -32,13 +32,15 @@ extern int dvb_usb_dib0700_debug; struct dib0700_state { u8 channel_state; - u8 mt2060_if1[2]; + u16 mt2060_if1[2]; }; extern int dib0700_set_gpio(struct dvb_usb_device *, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val); extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw); extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); extern struct i2c_algorithm dib0700_i2c_algo; +extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, + struct dvb_usb_device_description **desc, int *cold); extern int dib0700_device_count; extern struct dvb_usb_device_properties dib0700_devices[]; diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index 1f444a4411a5..75e8570f4ad8 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c @@ -26,7 +26,7 @@ static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen) USB_CTRL_GET_TIMEOUT); if (status != txlen) - err("ep 0 write error (status = %d, len: %d)",status,txlen); + deb_data("ep 0 write error (status = %d, len: %d)\n",status,txlen); return status < 0 ? status : 0; } @@ -65,7 +65,7 @@ static int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u USB_CTRL_GET_TIMEOUT); if (status < 0) - err("ep 0 read error (status = %d)",status); + deb_info("ep 0 read error (status = %d)\n",status); deb_data("<<< "); debug_dump(rx,rxlen,deb_data); @@ -130,6 +130,19 @@ struct i2c_algorithm dib0700_i2c_algo = { .functionality = dib0700_i2c_func, }; +int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, + struct dvb_usb_device_description **desc, int *cold) +{ + u8 buf[3] = { REQUEST_SET_GPIO, 4, (GPIO_IN << 7) | (0 << 6) }; // GPIO4 is save - used for I2C + *cold = usb_control_msg(udev, usb_sndctrlpipe(udev,0), + buf[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, buf, 3, USB_CTRL_GET_TIMEOUT) != 3; + + deb_info("cold: %d\n", *cold); + + *cold = 0; + return 0; +} + static int dib0700_jumpram(struct usb_device *udev, u32 address) { int ret, actlen; @@ -182,8 +195,10 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw if (ret == 0) { /* start the firmware */ - if ((ret = dib0700_jumpram(udev,0x70000000)) == 0) + if ((ret = dib0700_jumpram(udev, 0x70000000)) == 0) { info("firmware started successfully."); + msleep(100); + } } else ret = -EIO; diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 74d98dfb5ae7..da177e745e5e 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -25,24 +25,24 @@ static struct mt2060_config bristol_mt2060_config[2] = { static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = { .band_caps = BAND_VHF | BAND_UHF, - .setup = (0 << 15) | (0 << 14) | (1 << 13) | (1 << 12) | (29 << 0), + .setup = (0 << 15) | (0 << 14) | (0 << 13) | (0 << 12) | (29 << 0), - .agc1_max = 48497, - .agc1_min = 23593, - .agc2_max = 46531, - .agc2_min = 24904, + .agc1_max = 42598, + .agc1_min = 17694, + .agc2_max = 45875, + .agc2_min = 0, - .agc1_pt1 = 0x65, - .agc1_pt2 = 0x69, + .agc1_pt1 = 0, + .agc1_pt2 = 59, - .agc1_slope1 = 0x51, - .agc1_slope2 = 0x27, + .agc1_slope1 = 0, + .agc1_slope2 = 69, .agc2_pt1 = 0, - .agc2_pt2 = 0x33, + .agc2_pt2 = 59, - .agc2_slope1 = 0x35, - .agc2_slope2 = 0x37, + .agc2_slope1 = 111, + .agc2_slope2 = 28, }; static struct dib3000mc_config bristol_dib3000mc_config[2] = { @@ -60,25 +60,31 @@ static struct dib3000mc_config bristol_dib3000mc_config[2] = { static int bristol_frontend_attach(struct dvb_usb_adapter *adap) { + struct dib0700_state *st = adap->dev->priv; if (adap->id == 0) { dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10); dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10); + dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); msleep(10); // LNA + if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) { dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); return -ENODEV; } } - return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, 10 + adap->id, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0; + st->mt2060_if1[adap->id] = 1220; + return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, + (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0; } static int bristol_tuner_attach(struct dvb_usb_adapter *adap) { struct dib0700_state *st = adap->dev->priv; struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1); - return mt2060_attach(adap->fe, tun_i2c, &bristol_mt2060_config[adap->id], st->mt2060_if1[adap->id]); + return dvb_attach(mt2060_attach,adap->fe, tun_i2c, &bristol_mt2060_config[adap->id], + st->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0; } /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */ @@ -119,8 +125,10 @@ MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); .usb_ctrl = DEVICE_SPECIFIC, \ .firmware = "dvb-usb-dib0700-01.fw", \ .download_firmware = dib0700_download_firmware, \ + .no_reconnect = 1, \ .size_of_priv = sizeof(struct dib0700_state), \ - .i2c_algo = &dib0700_i2c_algo + .i2c_algo = &dib0700_i2c_algo, \ + .identify_state = dib0700_identify_state #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \ .streaming_ctrl = dib0700_streaming_ctrl, \ diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c index e1112e39fb63..4e986f12b674 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c @@ -80,6 +80,7 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_device_pro int ret; const struct firmware *fw = NULL; + if ((ret = request_firmware(&fw, props->firmware, &udev->dev)) != 0) { err("did not find the firmware file. (%s) " "Please see linux/Documentation/dvb/ for more details on firmware-problems. (%d)", diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index feb098727dc3..415a9892391d 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -94,8 +94,8 @@ #define USB_PID_WT220U_ZL0353_WARM 0x022b #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 -#define USB_PID_HAUPPAUGE_NOVA_T_500 0x1234 -#define USB_PID_HAUPPAUGE_NOVA_T_STICK 0x1234 +#define USB_PID_HAUPPAUGE_NOVA_T_500 0x9941 +#define USB_PID_HAUPPAUGE_NOVA_T_STICK 0x7050 #define USB_PID_AVERMEDIA_VOLAR 0x1234 #define USB_PID_NEBULA_DIGITV 0x0201 #define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index d7c4a98da125..60e10dba3684 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c @@ -830,6 +830,7 @@ struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr st->cfg = cfg; st->i2c_adap = i2c_adap; + st->i2c_addr = i2c_addr; demod = &st->demod; demod->demodulator_priv = st; diff --git a/drivers/media/dvb/frontends/mt2060.c b/drivers/media/dvb/frontends/mt2060.c index 19bd66a1816a..450fad8d9b65 100644 --- a/drivers/media/dvb/frontends/mt2060.c +++ b/drivers/media/dvb/frontends/mt2060.c @@ -332,14 +332,14 @@ static const struct dvb_tuner_ops mt2060_tuner_ops = { }; /* This functions tries to identify a MT2060 tuner by reading the PART/REV register. This is hasty. */ -int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) +struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) { struct mt2060_priv *priv = NULL; u8 id = 0; priv = kzalloc(sizeof(struct mt2060_priv), GFP_KERNEL); if (priv == NULL) - return -ENOMEM; + return NULL; priv->cfg = cfg; priv->i2c = i2c; @@ -347,12 +347,12 @@ int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt206 if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) { kfree(priv); - return -ENODEV; + return NULL; } if (id != PART_REV) { kfree(priv); - return -ENODEV; + return NULL; } printk(KERN_INFO "MT2060: successfully identified (IF1 = %d)\n", if1); memcpy(&fe->ops.tuner_ops, &mt2060_tuner_ops, sizeof(struct dvb_tuner_ops)); @@ -361,7 +361,7 @@ int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt206 mt2060_calibrate(priv); - return 0; + return fe; } EXPORT_SYMBOL(mt2060_attach); diff --git a/drivers/media/dvb/frontends/mt2060.h b/drivers/media/dvb/frontends/mt2060.h index 471d3326e29d..fc12c790f913 100644 --- a/drivers/media/dvb/frontends/mt2060.h +++ b/drivers/media/dvb/frontends/mt2060.h @@ -30,6 +30,6 @@ struct mt2060_config { u8 clock_out; /* 0 = off, 1 = CLK/1, 2 = CLK/2, 3 = CLK/4 */ }; -extern int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1); +extern struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1); #endif |