aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPatrick Boettcher <pb@linuxtv.org>2006-09-19 11:51:40 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-10-03 14:12:36 -0400
commit6958effedb0dc709966c22e7fd0e8210b5401b84 (patch)
treee9a0d9768b1a5e53c6667309d946cb6c3204e3c0 /drivers
parentb7f54910ce018f93a74211136be46c09cefd80e2 (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')
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700.h4
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_core.c21
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c38
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-firmware.c1
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h4
-rw-r--r--drivers/media/dvb/frontends/dib3000mc.c1
-rw-r--r--drivers/media/dvb/frontends/mt2060.c10
-rw-r--r--drivers/media/dvb/frontends/mt2060.h2
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;
32 32
33struct dib0700_state { 33struct dib0700_state {
34 u8 channel_state; 34 u8 channel_state;
35 u8 mt2060_if1[2]; 35 u16 mt2060_if1[2];
36}; 36};
37 37
38extern int dib0700_set_gpio(struct dvb_usb_device *, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val); 38extern int dib0700_set_gpio(struct dvb_usb_device *, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val);
39extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw); 39extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw);
40extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); 40extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
41extern struct i2c_algorithm dib0700_i2c_algo; 41extern struct i2c_algorithm dib0700_i2c_algo;
42extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
43 struct dvb_usb_device_description **desc, int *cold);
42 44
43extern int dib0700_device_count; 45extern int dib0700_device_count;
44extern struct dvb_usb_device_properties dib0700_devices[]; 46extern 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)
26 USB_CTRL_GET_TIMEOUT); 26 USB_CTRL_GET_TIMEOUT);
27 27
28 if (status != txlen) 28 if (status != txlen)
29 err("ep 0 write error (status = %d, len: %d)",status,txlen); 29 deb_data("ep 0 write error (status = %d, len: %d)\n",status,txlen);
30 30
31 return status < 0 ? status : 0; 31 return status < 0 ? status : 0;
32} 32}
@@ -65,7 +65,7 @@ static int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u
65 USB_CTRL_GET_TIMEOUT); 65 USB_CTRL_GET_TIMEOUT);
66 66
67 if (status < 0) 67 if (status < 0)
68 err("ep 0 read error (status = %d)",status); 68 deb_info("ep 0 read error (status = %d)\n",status);
69 69
70 deb_data("<<< "); 70 deb_data("<<< ");
71 debug_dump(rx,rxlen,deb_data); 71 debug_dump(rx,rxlen,deb_data);
@@ -130,6 +130,19 @@ struct i2c_algorithm dib0700_i2c_algo = {
130 .functionality = dib0700_i2c_func, 130 .functionality = dib0700_i2c_func,
131}; 131};
132 132
133int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
134 struct dvb_usb_device_description **desc, int *cold)
135{
136 u8 buf[3] = { REQUEST_SET_GPIO, 4, (GPIO_IN << 7) | (0 << 6) }; // GPIO4 is save - used for I2C
137 *cold = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
138 buf[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, buf, 3, USB_CTRL_GET_TIMEOUT) != 3;
139
140 deb_info("cold: %d\n", *cold);
141
142 *cold = 0;
143 return 0;
144}
145
133static int dib0700_jumpram(struct usb_device *udev, u32 address) 146static int dib0700_jumpram(struct usb_device *udev, u32 address)
134{ 147{
135 int ret, actlen; 148 int ret, actlen;
@@ -182,8 +195,10 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
182 195
183 if (ret == 0) { 196 if (ret == 0) {
184 /* start the firmware */ 197 /* start the firmware */
185 if ((ret = dib0700_jumpram(udev,0x70000000)) == 0) 198 if ((ret = dib0700_jumpram(udev, 0x70000000)) == 0) {
186 info("firmware started successfully."); 199 info("firmware started successfully.");
200 msleep(100);
201 }
187 } else 202 } else
188 ret = -EIO; 203 ret = -EIO;
189 204
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] = {
25 25
26static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = { 26static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
27 .band_caps = BAND_VHF | BAND_UHF, 27 .band_caps = BAND_VHF | BAND_UHF,
28 .setup = (0 << 15) | (0 << 14) | (1 << 13) | (1 << 12) | (29 << 0), 28 .setup = (0 << 15) | (0 << 14) | (0 << 13) | (0 << 12) | (29 << 0),
29 29
30 .agc1_max = 48497, 30 .agc1_max = 42598,
31 .agc1_min = 23593, 31 .agc1_min = 17694,
32 .agc2_max = 46531, 32 .agc2_max = 45875,
33 .agc2_min = 24904, 33 .agc2_min = 0,
34 34
35 .agc1_pt1 = 0x65, 35 .agc1_pt1 = 0,
36 .agc1_pt2 = 0x69, 36 .agc1_pt2 = 59,
37 37
38 .agc1_slope1 = 0x51, 38 .agc1_slope1 = 0,
39 .agc1_slope2 = 0x27, 39 .agc1_slope2 = 69,
40 40
41 .agc2_pt1 = 0, 41 .agc2_pt1 = 0,
42 .agc2_pt2 = 0x33, 42 .agc2_pt2 = 59,
43 43
44 .agc2_slope1 = 0x35, 44 .agc2_slope1 = 111,
45 .agc2_slope2 = 0x37, 45 .agc2_slope2 = 28,
46}; 46};
47 47
48static struct dib3000mc_config bristol_dib3000mc_config[2] = { 48static struct dib3000mc_config bristol_dib3000mc_config[2] = {
@@ -60,25 +60,31 @@ static struct dib3000mc_config bristol_dib3000mc_config[2] = {
60 60
61static int bristol_frontend_attach(struct dvb_usb_adapter *adap) 61static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
62{ 62{
63 struct dib0700_state *st = adap->dev->priv;
63 if (adap->id == 0) { 64 if (adap->id == 0) {
64 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); 65 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
65 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10); 66 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
66 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); 67 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
67 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10); 68 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
68 69
70 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); msleep(10); // LNA
71
69 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) { 72 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
70 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); 73 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
71 return -ENODEV; 74 return -ENODEV;
72 } 75 }
73 } 76 }
74 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, 10 + adap->id, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0; 77 st->mt2060_if1[adap->id] = 1220;
78 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
79 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
75} 80}
76 81
77static int bristol_tuner_attach(struct dvb_usb_adapter *adap) 82static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
78{ 83{
79 struct dib0700_state *st = adap->dev->priv; 84 struct dib0700_state *st = adap->dev->priv;
80 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1); 85 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
81 return mt2060_attach(adap->fe, tun_i2c, &bristol_mt2060_config[adap->id], st->mt2060_if1[adap->id]); 86 return dvb_attach(mt2060_attach,adap->fe, tun_i2c, &bristol_mt2060_config[adap->id],
87 st->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0;
82} 88}
83 89
84/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */ 90/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
@@ -119,8 +125,10 @@ MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
119 .usb_ctrl = DEVICE_SPECIFIC, \ 125 .usb_ctrl = DEVICE_SPECIFIC, \
120 .firmware = "dvb-usb-dib0700-01.fw", \ 126 .firmware = "dvb-usb-dib0700-01.fw", \
121 .download_firmware = dib0700_download_firmware, \ 127 .download_firmware = dib0700_download_firmware, \
128 .no_reconnect = 1, \
122 .size_of_priv = sizeof(struct dib0700_state), \ 129 .size_of_priv = sizeof(struct dib0700_state), \
123 .i2c_algo = &dib0700_i2c_algo 130 .i2c_algo = &dib0700_i2c_algo, \
131 .identify_state = dib0700_identify_state
124 132
125#define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \ 133#define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
126 .streaming_ctrl = dib0700_streaming_ctrl, \ 134 .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
80 int ret; 80 int ret;
81 const struct firmware *fw = NULL; 81 const struct firmware *fw = NULL;
82 82
83
83 if ((ret = request_firmware(&fw, props->firmware, &udev->dev)) != 0) { 84 if ((ret = request_firmware(&fw, props->firmware, &udev->dev)) != 0) {
84 err("did not find the firmware file. (%s) " 85 err("did not find the firmware file. (%s) "
85 "Please see linux/Documentation/dvb/ for more details on firmware-problems. (%d)", 86 "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 @@
94#define USB_PID_WT220U_ZL0353_WARM 0x022b 94#define USB_PID_WT220U_ZL0353_WARM 0x022b
95#define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 95#define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300
96#define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 96#define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301
97#define USB_PID_HAUPPAUGE_NOVA_T_500 0x1234 97#define USB_PID_HAUPPAUGE_NOVA_T_500 0x9941
98#define USB_PID_HAUPPAUGE_NOVA_T_STICK 0x1234 98#define USB_PID_HAUPPAUGE_NOVA_T_STICK 0x7050
99#define USB_PID_AVERMEDIA_VOLAR 0x1234 99#define USB_PID_AVERMEDIA_VOLAR 0x1234
100#define USB_PID_NEBULA_DIGITV 0x0201 100#define USB_PID_NEBULA_DIGITV 0x0201
101#define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 101#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
830 830
831 st->cfg = cfg; 831 st->cfg = cfg;
832 st->i2c_adap = i2c_adap; 832 st->i2c_adap = i2c_adap;
833 st->i2c_addr = i2c_addr;
833 834
834 demod = &st->demod; 835 demod = &st->demod;
835 demod->demodulator_priv = st; 836 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 = {
332}; 332};
333 333
334/* This functions tries to identify a MT2060 tuner by reading the PART/REV register. This is hasty. */ 334/* This functions tries to identify a MT2060 tuner by reading the PART/REV register. This is hasty. */
335int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) 335struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1)
336{ 336{
337 struct mt2060_priv *priv = NULL; 337 struct mt2060_priv *priv = NULL;
338 u8 id = 0; 338 u8 id = 0;
339 339
340 priv = kzalloc(sizeof(struct mt2060_priv), GFP_KERNEL); 340 priv = kzalloc(sizeof(struct mt2060_priv), GFP_KERNEL);
341 if (priv == NULL) 341 if (priv == NULL)
342 return -ENOMEM; 342 return NULL;
343 343
344 priv->cfg = cfg; 344 priv->cfg = cfg;
345 priv->i2c = i2c; 345 priv->i2c = i2c;
@@ -347,12 +347,12 @@ int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt206
347 347
348 if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) { 348 if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) {
349 kfree(priv); 349 kfree(priv);
350 return -ENODEV; 350 return NULL;
351 } 351 }
352 352
353 if (id != PART_REV) { 353 if (id != PART_REV) {
354 kfree(priv); 354 kfree(priv);
355 return -ENODEV; 355 return NULL;
356 } 356 }
357 printk(KERN_INFO "MT2060: successfully identified (IF1 = %d)\n", if1); 357 printk(KERN_INFO "MT2060: successfully identified (IF1 = %d)\n", if1);
358 memcpy(&fe->ops.tuner_ops, &mt2060_tuner_ops, sizeof(struct dvb_tuner_ops)); 358 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
361 361
362 mt2060_calibrate(priv); 362 mt2060_calibrate(priv);
363 363
364 return 0; 364 return fe;
365} 365}
366EXPORT_SYMBOL(mt2060_attach); 366EXPORT_SYMBOL(mt2060_attach);
367 367
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 {
30 u8 clock_out; /* 0 = off, 1 = CLK/1, 2 = CLK/2, 3 = CLK/4 */ 30 u8 clock_out; /* 0 = off, 1 = CLK/1, 2 = CLK/2, 3 = CLK/4 */
31}; 31};
32 32
33extern int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1); 33extern struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1);
34 34
35#endif 35#endif