Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 367120
b: refs/heads/master
c: f8fde0e
h: refs/heads/master
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Apr 17, 2013
1 parent f80d920 commit 68f0113
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 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: 6889ab2a25cf39a048edc69b4d61884b8b4da6b0
refs/heads/master: f8fde0e045aeac4417b09bef01b3ada74a4cbc80
30 changes: 27 additions & 3 deletions trunk/drivers/media/tuners/r820t.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,18 @@ static int r820t_set_tv_standard(struct r820t_priv *priv,
return 0;
}

static int r820t_read_gain(struct r820t_priv *priv)
{
u8 data[4];
int rc;

rc = r820_read(priv, 0x00, data, sizeof(data));
if (rc < 0)
return rc;

return ((data[3] & 0x0f) << 1) + ((data[3] & 0xf0) >> 4);
}

static int generic_set_freq(struct dvb_frontend *fe,
u32 freq /* in HZ */,
unsigned bw,
Expand Down Expand Up @@ -1353,11 +1365,23 @@ static int r820t_set_params(struct dvb_frontend *fe)
static int r820t_signal(struct dvb_frontend *fe, u16 *strength)
{
struct r820t_priv *priv = fe->tuner_priv;
int rc = 0;

if (priv->has_lock)
*strength = 0xffff;
else
if (priv->has_lock) {
rc = r820t_read_gain(priv);
if (rc < 0)
return rc;

/* A higher gain at LNA means a lower signal strength */
*strength = (45 - rc) << 4 | 0xff;
} else {
*strength = 0;
}

tuner_dbg("%s: %s, gain=%d strength=%d\n",
__func__,
priv->has_lock ? "PLL locked" : "no signal",
rc, *strength);

return 0;
}
Expand Down

0 comments on commit 68f0113

Please sign in to comment.