En/na Luca Olivetti ha escrit:
En/na Trent Piepho ha escrit:
But dvb_frontend_detach _does_ have fe->ops.tuner_ops.release().
Now I see it! It's mt2060_attach (or qt1010_attach) that fills
tuner_ops. Duh, I missed that one. I'll make a patch tomorrow.
Attached.
I can test it up to the point where it correctly attaches the mt2060,
but then I don't know if it tunes correctly since my stick doesn't work
(though it should, since it does the same as before, only without the
extra "tuner" pointer). Olaf, could you give it a try?
I also tried (again) to unload and reload the module and, while at first
it seems to recognize and initialize, after a (short) while it gives
bulk transfer errors, so in case the module is unloaded the stick must
be reconnected.
Maybe the usb_clear_halt in af9005.c should be somewhere else, at the
time it seemed to work where it is (I had to duplicate what dvb-usb-init
does since the "standard" dvb-usb uses a single endpoint for bulk
transfers, while the af9005 uses one for writing and another one for
reading).
Bye
--
Luca
diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/af9005-fe.c
--- a/linux/drivers/media/dvb/dvb-usb/af9005-fe.c Wed Jun 13 15:11:15 2007 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/af9005-fe.c Fri Jun 15 01:26:16 2007 +0200
@@ -29,8 +29,6 @@
struct af9005_fe_state {
struct dvb_usb_device *d;
- struct dvb_frontend *tuner;
-
fe_status_t stat;
/* retraining parameters */
@@ -454,7 +452,7 @@ static int af9005_fe_read_status(struct
#endif
int ret;
- if (state->tuner == NULL)
+ if (fe->ops.tuner_ops.release == NULL)
return -ENODEV;
*stat = 0;
@@ -512,7 +510,7 @@ static int af9005_fe_read_ber(struct dvb
static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber)
{
struct af9005_fe_state *state = fe->demodulator_priv;
- if (state->tuner == NULL)
+ if (fe->ops.tuner_ops.release == NULL)
return -ENODEV;
af9005_fe_refresh_state(fe);
*ber = state->ber;
@@ -522,7 +520,7 @@ static int af9005_fe_read_unc_blocks(str
static int af9005_fe_read_unc_blocks(struct dvb_frontend *fe, u32 * unc)
{
struct af9005_fe_state *state = fe->demodulator_priv;
- if (state->tuner == NULL)
+ if (fe->ops.tuner_ops.release == NULL)
return -ENODEV;
af9005_fe_refresh_state(fe);
*unc = state->unc;
@@ -536,7 +534,7 @@ static int af9005_fe_read_signal_strengt
int ret;
u8 if_gain, rf_gain;
- if (state->tuner == NULL)
+ if (fe->ops.tuner_ops.release == NULL)
return -ENODEV;
ret =
af9005_read_ofdm_register(state->d, xd_r_reg_aagc_rf_gain,
@@ -827,11 +825,11 @@ static int af9005_fe_power(struct dvb_fr
#if 0
if (ret)
return ret;
- if (state->tuner != NULL) {
+ if (fe->ops.tuner_ops.init != NULL) {
if (on)
- ret = state->tuner->ops.tuner_ops.init(state->tuner);
+ ret = fe->ops.tuner_ops.init(fe);
else
- ret = state->tuner->ops.tuner_ops.sleep(state->tuner);
+ ret = fe->ops.tuner_ops.sleep(fe);
}
#endif
return ret;
@@ -1135,7 +1133,7 @@ static int af9005_fe_init(struct dvb_fro
return ret;
#endif
/* attach tuner and init */
- if (state->tuner == NULL) {
+ if (fe->ops.tuner_ops.release == NULL) {
/* read tuner and board id from eeprom */
ret = af9005_read_eeprom(adap->dev, 0xc6, buf, 2);
if (ret) {
@@ -1152,20 +1150,16 @@ static int af9005_fe_init(struct dvb_fro
return ret;
}
if1 = (u16) (buf[0] << 8) + buf[1];
- state->tuner =
- dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap,
- &af9005_mt2060_config, if1);
- if (state->tuner == NULL) {
+ if (dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap,
+ &af9005_mt2060_config, if1) == NULL) {
deb_info("MT2060 attach failed\n");
return -ENODEV;
}
break;
case 3: /* QT1010 */
case 9: /* QT1010B */
- state->tuner =
- dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap,
- &af9005_qt1010_config);
- if (state->tuner == NULL) {
+ if (dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap,
+ &af9005_qt1010_config) ==NULL) {
deb_info("QT1010 attach failed\n");
return -ENODEV;
}
@@ -1174,7 +1168,7 @@ static int af9005_fe_init(struct dvb_fro
err("Unsupported tuner type %d", buf[0]);
return -ENODEV;
}
- ret = state->tuner->ops.tuner_ops.init(state->tuner);
+ ret = fe->ops.tuner_ops.init(fe);
if (ret)
return ret;
}
@@ -1212,7 +1206,7 @@ static int af9005_fe_set_frontend(struct
deb_info("af9005_fe_set_frontend freq %d bw %d\n", fep->frequency,
fep->u.ofdm.bandwidth);
- if (state->tuner == NULL) {
+ if (fe->ops.tuner_ops.release == NULL) {
err("Tuner not attached");
return -ENODEV;
}
@@ -1300,7 +1294,7 @@ static int af9005_fe_set_frontend(struct
#endif
/* set tuner */
deb_info("set tuner\n");
- ret = state->tuner->ops.tuner_ops.set_params(state->tuner, fep);
+ ret = fe->ops.tuner_ops.set_params(fe, fep);
if (ret)
return ret;
@@ -1576,12 +1570,6 @@ static void af9005_fe_release(struct dvb
{
struct af9005_fe_state *state =
(struct af9005_fe_state *)fe->demodulator_priv;
- if (state->tuner != NULL && state->tuner->ops.tuner_ops.release != NULL) {
- state->tuner->ops.tuner_ops.release(state->tuner);
-#ifdef CONFIG_DVB_CORE_ATTACH
- symbol_put_addr(state->tuner->ops.tuner_ops.release);
-#endif
- }
kfree(state);
}
@@ -1599,7 +1587,6 @@ struct dvb_frontend *af9005_fe_attach(st
deb_info("attaching frontend af9005\n");
state->d = d;
- state->tuner = NULL;
state->opened = 0;
memcpy(&state->frontend.ops, &af9005_fe_ops,
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb