Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285173
b: refs/heads/master
c: 19661c0
h: refs/heads/master
i:
  285171: e5912fc
v: v3
  • Loading branch information
Michael Krufky authored and Mauro Carvalho Chehab committed Nov 7, 2011
1 parent 8f102ca commit 8e04041
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 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: 5279b1ff3699153a53d7ca030b5fb95950001c36
refs/heads/master: 19661c08fe11590e04832ed8b3cabe5e4bf11e48
31 changes: 30 additions & 1 deletion trunk/drivers/media/dvb/frontends/s5h1409.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,36 @@ static int s5h1409_read_snr(struct dvb_frontend *fe, u16 *snr)
static int s5h1409_read_signal_strength(struct dvb_frontend *fe,
u16 *signal_strength)
{
return s5h1409_read_snr(fe, signal_strength);
/* borrowed from lgdt330x.c
*
* Calculate strength from SNR up to 35dB
* Even though the SNR can go higher than 35dB,
* there is some comfort factor in having a range of
* strong signals that can show at 100%
*/
u16 snr;
u32 tmp;
int ret = s5h1409_read_snr(fe, &snr);

*signal_strength = 0;

if (0 == ret) {
/* The following calculation method was chosen
* purely for the sake of code re-use from the
* other demod drivers that use this method */

/* Convert from SNR in dB * 10 to 8.24 fixed-point */
tmp = (snr * ((1 << 24) / 10));

/* Convert from 8.24 fixed-point to
* scale the range 0 - 35*2^24 into 0 - 65535*/
if (tmp >= 8960 * 0x10000)
*signal_strength = 0xffff;
else
*signal_strength = tmp / 8960;
}

return ret;
}

static int s5h1409_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
Expand Down

0 comments on commit 8e04041

Please sign in to comment.