Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202086
b: refs/heads/master
c: 8145223
h: refs/heads/master
v: v3
  • Loading branch information
Guillaume Audirac authored and Mauro Carvalho Chehab committed Aug 2, 2010
1 parent 58818bf commit 064d715
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 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: e38030f3ff02684eb9e25e983a03ad318a10a2ea
refs/heads/master: 814522394ce1b6385571e3eaf747e99ab189a3c1
30 changes: 24 additions & 6 deletions trunk/drivers/media/dvb/frontends/tda10048.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/math64.h>
#include <asm/div64.h>
#include "dvb_frontend.h"
#include "dvb_math.h"
Expand Down Expand Up @@ -112,15 +113,15 @@
#define TDA10048_FREE_REG_1 0xB2
#define TDA10048_FREE_REG_2 0xB3
#define TDA10048_CONF_C3_1 0xC0
#define TDA10048_CYBER_CTRL 0xC2
#define TDA10048_CVBER_CTRL 0xC2
#define TDA10048_CBER_NMAX_LSB 0xC4
#define TDA10048_CBER_NMAX_MSB 0xC5
#define TDA10048_CBER_LSB 0xC6
#define TDA10048_CBER_MSB 0xC7
#define TDA10048_VBER_LSB 0xC8
#define TDA10048_VBER_MID 0xC9
#define TDA10048_VBER_MSB 0xCA
#define TDA10048_CYBER_LUT 0xCC
#define TDA10048_CVBER_LUT 0xCC
#define TDA10048_UNCOR_CTRL 0xCD
#define TDA10048_UNCOR_CPT_LSB 0xCE
#define TDA10048_UNCOR_CPT_MSB 0xCF
Expand Down Expand Up @@ -183,7 +184,7 @@ static struct init_tab {
{ TDA10048_AGC_IF_MAX, 0xff },
{ TDA10048_AGC_THRESHOLD_MSB, 0x00 },
{ TDA10048_AGC_THRESHOLD_LSB, 0x70 },
{ TDA10048_CYBER_CTRL, 0x38 },
{ TDA10048_CVBER_CTRL, 0x38 },
{ TDA10048_AGC_GAINS, 0x12 },
{ TDA10048_CONF_XO, 0x00 },
{ TDA10048_CONF_TS1, 0x07 },
Expand Down Expand Up @@ -765,6 +766,8 @@ static int tda10048_set_frontend(struct dvb_frontend *fe,

/* Enable demod TPS auto detection and begin acquisition */
tda10048_writereg(state, TDA10048_AUTO, 0x57);
/* trigger cber and vber acquisition */
tda10048_writereg(state, TDA10048_CVBER_CTRL, 0x3B);

return 0;
}
Expand Down Expand Up @@ -830,12 +833,27 @@ static int tda10048_read_status(struct dvb_frontend *fe, fe_status_t *status)
static int tda10048_read_ber(struct dvb_frontend *fe, u32 *ber)
{
struct tda10048_state *state = fe->demodulator_priv;
static u32 cber_current;
u32 cber_nmax;
u64 cber_tmp;

dprintk(1, "%s()\n", __func__);

/* TODO: A reset may be required here */
*ber = tda10048_readreg(state, TDA10048_CBER_MSB) << 8 |
tda10048_readreg(state, TDA10048_CBER_LSB);
/* update cber on interrupt */
if (tda10048_readreg(state, TDA10048_SOFT_IT_C3) & 0x01) {
cber_tmp = tda10048_readreg(state, TDA10048_CBER_MSB) << 8 |
tda10048_readreg(state, TDA10048_CBER_LSB);
cber_nmax = tda10048_readreg(state, TDA10048_CBER_NMAX_MSB) << 8 |
tda10048_readreg(state, TDA10048_CBER_NMAX_LSB);
cber_tmp *= 100000000;
cber_tmp *= 2;
cber_tmp = div_u64(cber_tmp, (cber_nmax * 32) + 1);
cber_current = (u32)cber_tmp;
/* retrigger cber acquisition */
tda10048_writereg(state, TDA10048_CVBER_CTRL, 0x39);
}
/* actual cber is (*ber)/1e8 */
*ber = cber_current;

return 0;
}
Expand Down

0 comments on commit 064d715

Please sign in to comment.