From 06af0f90f50cf955854fb814982a81a6aadbe3a6 Mon Sep 17 00:00:00 2001 From: Kyle Keen Date: Wed, 27 Aug 2014 18:44:58 -0400 Subject: [PATCH] r82xx: direct sampling fixes from tejeez --- src/tuner_r82xx.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/tuner_r82xx.c b/src/tuner_r82xx.c index e4a1232..691ac6f 100644 --- a/src/tuner_r82xx.c +++ b/src/tuner_r82xx.c @@ -946,7 +946,7 @@ static int r82xx_set_if_filter(struct r82xx_priv *priv, int hpf, int lpf) { else if(cal > 15) cal = 15; priv->fil_cal_code = cal; - fprintf(stderr, "Setting IF filter for %d...%d kHz: hp_cor=0x%02x, fil_cal_code=%d\n", hpf, lpf, hp_cor, cal); + //fprintf(stderr, "Setting IF filter for %d...%d kHz: hp_cor=0x%02x, fil_cal_code=%d\n", hpf, lpf, hp_cor, cal); rc = r82xx_write_reg_mask(priv, 0x0a, filt_q | priv->fil_cal_code, 0x1f); @@ -1113,17 +1113,22 @@ int r82xx_set_nomod(struct r82xx_priv *priv) fprintf(stderr, "Using R820T no-mod direct sampling mode\n"); - /*rc = r82xx_set_bw(priv, 1000000); - if (rc < 0) - goto err;*/ + /* should probably play a bit more with the mux settings + to see if something works even better than this */ - /* experimentally determined magic numbers - * needs more experimenting with all the registers */ rc = r82xx_set_mux(priv, 300000000); - if (rc < 0) - goto err; + if (rc < 0) goto err; - r82xx_set_pll(priv, 25000000); + /* the VCO frequency setting still seems to have some effect on the noise floor */ + rc = r82xx_set_pll(priv, 50000000); + if (rc < 0) goto err; + + /* the most important part: set a divider number that does not really work */ + rc = r82xx_write_reg_mask(priv, 0x10, 0xd0, 0xe0); + if (rc < 0) goto err; + + /* VCO power off? */ + rc = r82xx_write_reg_mask(priv, 0x12, 0xe0, 0xe0); err: if (rc < 0)