summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorJohannes Stezenbach <devnull@localhost>2003-06-17 12:01:33 +0000
committerJohannes Stezenbach <devnull@localhost>2003-06-17 12:01:33 +0000
commitf4b75ce0dd2c1a4c747f7d66233f33adf6b0fbc5 (patch)
tree71aefa02d6ce1960ccbd0b5b7601325fdc2ba86b /linux/drivers
parentb5e32844f33cc90920e5469fa77b9b6ebca9cf3a (diff)
downloadmediapointer-dvb-s2-f4b75ce0dd2c1a4c747f7d66233f33adf6b0fbc5.tar.gz
mediapointer-dvb-s2-f4b75ce0dd2c1a4c747f7d66233f33adf6b0fbc5.tar.bz2
Patch by Andrew de Quincey:
1) Now tunes properly! Previously it could only tune to certain frequencies 'cos of a rounding bug in the calculations. 2) Made it less noisy so it doesn't print disturbing messages when probing for a tda10045h fails. 3) Added FIXME comments in appropriate unfinished places.
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/dvb/frontends/tda10045h.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/linux/drivers/media/dvb/frontends/tda10045h.c b/linux/drivers/media/dvb/frontends/tda10045h.c
index 46e959baf..47fd5afc0 100644
--- a/linux/drivers/media/dvb/frontends/tda10045h.c
+++ b/linux/drivers/media/dvb/frontends/tda10045h.c
@@ -153,7 +153,7 @@ int tda10045h_write_byte(struct dvb_i2c_bus *i2c, int reg, int data)
ret = i2c->xfer(i2c, &msg, 1);
if (ret != 1)
- printk("%s: error reg=0x%x, data=0x%x, ret=%i\n",
+ dprintk("%s: error reg=0x%x, data=0x%x, ret=%i\n",
__FUNCTION__, reg, data, ret);
dprintk("%s: success reg=0x%x, data=0x%x, ret=%i\n", __FUNCTION__,
@@ -177,7 +177,7 @@ int tda10045h_read_byte(struct dvb_i2c_bus *i2c, int reg)
ret = i2c->xfer(i2c, msg, 2);
if (ret != 2) {
- printk("%s: error reg=0x%x, ret=%i\n", __FUNCTION__, reg,
+ dprintk("%s: error reg=0x%x, ret=%i\n", __FUNCTION__, reg,
ret);
return -1;
}
@@ -191,12 +191,12 @@ static
int tda10045h_write_mask(struct dvb_i2c_bus *i2c, int reg, int mask,
int data)
{
-
+ int val;
dprintk("%s: reg=0x%x, mask=0x%x, data=0x%x\n", __FUNCTION__, reg,
mask, data);
// read a byte and check
- int val = tda10045h_read_byte(i2c, reg);
+ val = tda10045h_read_byte(i2c, reg);
if (val < 0)
return val;
@@ -230,10 +230,10 @@ int tda10045h_write_buf(struct dvb_i2c_bus *i2c, int reg,
static
int tda10045h_enable_tuner_i2c(struct dvb_i2c_bus *i2c)
{
-
+ int result;
dprintk("%s\n", __FUNCTION__);
- int result = tda10045h_write_mask(i2c, TDA10045H_CONFC4, 2, 2);
+ result = tda10045h_write_mask(i2c, TDA10045H_CONFC4, 2, 2);
dvb_delay(1);
return result;
}
@@ -530,7 +530,7 @@ int tda10045h_set_frequency(struct dvb_i2c_bus *i2c,
// setup tuner buffer
tuner_frequency =
- ((fe_params->frequency * 6) + 217502000) / 1000000;
+ (((fe_params->frequency / 1000) * 6) + 217502) / 1000;
tuner_buf[0] = tuner_frequency >> 8;
tuner_buf[1] = tuner_frequency & 0xff;
tuner_buf[2] = 0x88;
@@ -570,7 +570,6 @@ int tda10045h_set_frequency(struct dvb_i2c_bus *i2c,
case TDA10045H_TDM1316L_ADDRESS:
// determine settings
tuner_frequency = fe_params->frequency + 36167000;
- dprintk("tuner_freq: %i\n", tuner_frequency);
if (tuner_frequency < 87000000) {
return -EINVAL;
} else if (tuner_frequency < 130000000) {
@@ -628,7 +627,7 @@ int tda10045h_set_frequency(struct dvb_i2c_bus *i2c,
// calculate tuner parameters
tuner_frequency =
- ((fe_params->frequency * 6) + 217502000) / 1000000;
+ (((fe_params->frequency / 1000) * 6) + 217502) / 1000;
tuner_buf[0] = tuner_frequency >> 8;
tuner_buf[1] = tuner_frequency & 0xff;
tuner_buf[2] = 0xca;
@@ -990,6 +989,7 @@ int tda10045h_read_snr(struct dvb_i2c_bus *i2c, u16 * snr)
tmp = tda10045h_read_byte(i2c, TDA10045H_SNR);
if (tmp < 0)
return -EIO;
+ // FIXME: calculate this properly
// done
*snr = tmp;
@@ -1023,7 +1023,8 @@ int tda10045h_read_ucblocks(struct dvb_i2c_bus *i2c, u32 * ucblocks)
if ((tmp2 < tmp) || (tmp2 == 0))
break;
}
-
+ // FIXME: calculate this properly
+
// done
if (tmp != 0x7f) {
*ucblocks = tmp;
@@ -1049,7 +1050,8 @@ int tda10045h_read_vber(struct dvb_i2c_bus *i2c, u32 * vber)
// reset counter
tda10045h_read_byte(i2c, TDA10045H_CVBER_LUT);
-
+ // FIXME: calculate this properly
+
// done
dprintk("%s: vber=0x%x\n", __FUNCTION__, *vber);
return 0;