diff options
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/dvb/frontends/grundig_29504-401.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/linux/drivers/media/dvb/frontends/grundig_29504-401.c b/linux/drivers/media/dvb/frontends/grundig_29504-401.c index b85c2423d..ecf9383e7 100644 --- a/linux/drivers/media/dvb/frontends/grundig_29504-401.c +++ b/linux/drivers/media/dvb/frontends/grundig_29504-401.c @@ -37,15 +37,15 @@ static int debug = 0; struct dvb_frontend_info grundig_29504_401_info = { - .name = "Grundig 29504-401", - .type = FE_OFDM, -/* .frequency_min = ???,*/ -/* .frequency_max = ???,*/ - .frequency_stepsize = 166666, -/* .frequency_tolerance = ???,*/ -/* .symbol_rate_tolerance = ???,*/ - .notifier_delay = 0, - .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | + name: "Grundig 29504-401", + type: FE_OFDM, +/* frequency_min: ???,*/ +/* frequency_max: ???,*/ + frequency_stepsize: 166666, +/* frequency_tolerance: ???,*/ +/* symbol_rate_tolerance: ???,*/ + notifier_delay: 0, + caps: FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_MUTE_TS /*| FE_CAN_CLEAN_SETUP*/ @@ -276,12 +276,12 @@ int apply_frontend_param (struct dvb_i2c_bus *i2c, static -void reset_and_configure (struct dvb_i2c_bus *i2c) +int reset_and_configure (struct dvb_i2c_bus *i2c) { u8 buf [] = { 0x06 }; struct i2c_msg msg = { .addr = 0x00, .flags = 0, .buf = buf, .len = 1 }; - i2c->xfer (i2c, &msg, 1); + return (i2c->xfer (i2c, &msg, 1) == 1) ? 0 : -ENODEV; } @@ -428,21 +428,38 @@ int grundig_29504_401_ioctl (struct dvb_frontend *fe, static int l64781_attach (struct dvb_i2c_bus *i2c) { + u8 reg0x3e; u8 b0 [] = { 0x1a }; u8 b1 [] = { 0x00 }; struct i2c_msg msg [] = { { .addr = 0x55, .flags = 0, .buf = b0, .len = 1 }, { .addr = 0x55, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; - if (i2c->xfer (i2c, msg, 2) == 2) /* probably an EEPROM... */ + /** + * the L64781 won't show up before we send the reset_and_configure() + * broadcast. If nothing responds there is no L64781 on the bus... + */ + if (reset_and_configure(i2c) < 0) { + dprintk("no response on reset_and_configure() broadcast, bailing out...\n"); return -ENODEV; + } + + reg0x3e = l64781_readreg(i2c, 0x3e); - reset_and_configure (i2c); + /** + * if we see a powered down L64781 we wake it up... + */ + if (reg0x3e == 0x5a) { + dprintk("waking up sleeping L64781...\n"); + l64781_writereg (i2c, 0x3e, 0xa5); + } - if (i2c->xfer (i2c, msg, 2) != 2) /* nothing... */ + if (i2c->xfer(i2c, msg, 2) != 2) /* nothing... */ return -ENODEV; - if (b1[0] != 0xa1) + if (b1[0] != 0xa1) { /* oops, we're tried to talk to an EEPROM...*/ + l64781_writereg (i2c, 0x3e, reg0x3e); /* restore reg 0x3e */ return -ENODEV; + } dvb_register_frontend (grundig_29504_401_ioctl, i2c, NULL, &grundig_29504_401_info); |