Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 44087
b: refs/heads/master
c: 89faeef
h: refs/heads/master
i:
  44085: 9b20f98
  44083: b523ac6
  44079: 3330add
v: v3
  • Loading branch information
Michael Krufky authored and Mauro Carvalho Chehab committed Dec 10, 2006
1 parent f44e8c3 commit 231554a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 47ae9ae895a5228e7a3ca47b1c9ab00a3f641923
refs/heads/master: 89faeefcf875c16d8923eaed50bd57731c221bcc
44 changes: 14 additions & 30 deletions trunk/drivers/media/dvb/frontends/dvb-pll.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n",
desc->name, div, buf[0], buf[1], buf[2], buf[3]);

return 0;
// calculate the frequency we set it to
return (div * desc->entries[i].stepsize) - desc->entries[i].offset;
}
EXPORT_SYMBOL(dvb_pll_configure);

Expand Down Expand Up @@ -526,9 +527,7 @@ static int dvb_pll_set_params(struct dvb_frontend *fe,
{ .addr = priv->pll_i2c_address, .flags = 0,
.buf = buf, .len = sizeof(buf) };
int result;
u32 div;
int i;
u32 bandwidth = 0;
u32 bandwidth = 0, frequency = 0;

if (priv->i2c == NULL)
return -EINVAL;
Expand All @@ -538,26 +537,19 @@ static int dvb_pll_set_params(struct dvb_frontend *fe,
bandwidth = params->u.ofdm.bandwidth;
}

if ((result = dvb_pll_configure(priv->pll_desc, buf, params->frequency,
bandwidth)) != 0)
if ((result = dvb_pll_configure(priv->pll_desc, buf,
params->frequency, bandwidth)) < 0)
return result;
else
frequency = result;

if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
return result;
}

// calculate the frequency we set it to
for (i = 0; i < priv->pll_desc->count; i++) {
if (params->frequency > priv->pll_desc->entries[i].limit)
continue;
break;
}
div = (params->frequency + priv->pll_desc->entries[i].offset) /
priv->pll_desc->entries[i].stepsize;
priv->frequency = (div * priv->pll_desc->entries[i].stepsize) -
priv->pll_desc->entries[i].offset;
priv->frequency = frequency;
priv->bandwidth = bandwidth;

return 0;
Expand All @@ -569,9 +561,7 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe,
{
struct dvb_pll_priv *priv = fe->tuner_priv;
int result;
u32 div;
int i;
u32 bandwidth = 0;
u32 bandwidth = 0, frequency = 0;

if (buf_len < 5)
return -EINVAL;
Expand All @@ -582,20 +572,14 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe,
}

if ((result = dvb_pll_configure(priv->pll_desc, buf+1,
params->frequency, bandwidth)) != 0)
params->frequency, bandwidth)) < 0)
return result;
else
frequency = result;

buf[0] = priv->pll_i2c_address;

// calculate the frequency we set it to
for (i = 0; i < priv->pll_desc->count; i++) {
if (params->frequency > priv->pll_desc->entries[i].limit)
continue;
break;
}
div = (params->frequency + priv->pll_desc->entries[i].offset) /
priv->pll_desc->entries[i].stepsize;
priv->frequency = (div * priv->pll_desc->entries[i].stepsize) -
priv->pll_desc->entries[i].offset;
priv->frequency = frequency;
priv->bandwidth = bandwidth;

return 5;
Expand Down

0 comments on commit 231554a

Please sign in to comment.