Commit 2ce4b3aa authored by Chris Pascoe's avatar Chris Pascoe Committed by Mauro Carvalho Chehab

V4L/DVB (6639): xc2028: correct divisor length

The frequency divisor should only be four bytes long.  Also, display the
frequency and divisor correctly in the debug output.
Signed-off-by: default avatarChris Pascoe <c.pascoe@itee.uq.edu.au>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 06fd82dc
...@@ -740,7 +740,7 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ , ...@@ -740,7 +740,7 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ ,
{ {
struct xc2028_data *priv = fe->tuner_priv; struct xc2028_data *priv = fe->tuner_priv;
int rc = -EINVAL; int rc = -EINVAL;
unsigned char buf[5]; unsigned char buf[4];
u32 div, offset = 0; u32 div, offset = 0;
tuner_dbg("%s called\n", __FUNCTION__); tuner_dbg("%s called\n", __FUNCTION__);
...@@ -758,7 +758,7 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ , ...@@ -758,7 +758,7 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ ,
goto ret; goto ret;
msleep(10); msleep(10);
tuner_dbg("should set frequency %d kHz)\n", freq / 1000); tuner_dbg("should set frequency %d kHz\n", freq / 1000);
if (check_firmware(fe, new_mode, std, bandwidth) < 0) if (check_firmware(fe, new_mode, std, bandwidth) < 0)
goto ret; goto ret;
...@@ -769,7 +769,6 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ , ...@@ -769,7 +769,6 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ ,
div = (freq - offset + DIV / 2) / DIV; div = (freq - offset + DIV / 2) / DIV;
/* CMD= Set frequency */ /* CMD= Set frequency */
if (priv->firm_version < 0x0202) if (priv->firm_version < 0x0202)
rc = send_seq(priv, {0x00, 0x02, 0x00, 0x00}); rc = send_seq(priv, {0x00, 0x02, 0x00, 0x00});
else else
...@@ -787,7 +786,6 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ , ...@@ -787,7 +786,6 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ ,
buf[1] = 0xff & (div >> 16); buf[1] = 0xff & (div >> 16);
buf[2] = 0xff & (div >> 8); buf[2] = 0xff & (div >> 8);
buf[3] = 0xff & (div); buf[3] = 0xff & (div);
buf[4] = 0;
rc = i2c_send(priv, buf, sizeof(buf)); rc = i2c_send(priv, buf, sizeof(buf));
if (rc < 0) if (rc < 0)
...@@ -796,9 +794,9 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ , ...@@ -796,9 +794,9 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ ,
priv->frequency = freq; priv->frequency = freq;
tuner_dbg("divider= %02x %02x %02x %02x (freq=%d.%02d)\n", tuner_dbg("divisor= %02x %02x %02x %02x (freq=%d.%03d)\n",
buf[1], buf[2], buf[3], buf[4], buf[0], buf[1], buf[2], buf[3],
freq / 1000000, (freq % 1000000) / 10000); freq / 1000000, (freq % 1000000) / 1000);
rc = 0; rc = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment