tuner_fc001x: fix tuning for frequencies < 45 MHz

This allows tuning to 27 MHz for example (civil band).
Best results are achieved when setting the gain to
very low values.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
master
Steve Markgraf 12 years ago
parent b4e48d9555
commit 18687916d6
  1. 8
      src/tuner_fc0012.c
  2. 8
      src/tuner_fc0013.c

@ -206,7 +206,6 @@ int fc0012_set_params(void *dev, uint32_t freq, uint32_t bandwidth)
vco_select = 1;
}
if (freq >= 45000000) {
/* From divided value (XDIV) determined the FA and FP value */
xdiv = (uint16_t)(f_vco / xtal_freq_div_2);
if ((f_vco - xdiv * xtal_freq_div_2) >= (xtal_freq_div_2 / 2))
@ -228,16 +227,11 @@ int fc0012_set_params(void *dev, uint32_t freq, uint32_t bandwidth)
reg[2] = pm;
}
if (reg[1] > 15) {
if ((reg[1] > 15) || (reg[2] < 0x0b)) {
fprintf(stderr, "[FC0012] no valid PLL combination "
"found for %u Hz!\n", freq);
return -1;
}
} else {
/* fix for frequency less than 45 MHz */
reg[1] = 0x06;
reg[2] = 0x11;
}
/* fix clock out */
reg[6] |= 0x20;

@ -311,7 +311,6 @@ int fc0013_set_params(void *dev, uint32_t freq, uint32_t bandwidth)
vco_select = 1;
}
if (freq >= 45000000) {
/* From divided value (XDIV) determined the FA and FP value */
xdiv = (uint16_t)(f_vco / xtal_freq_div_2);
if ((f_vco - xdiv * xtal_freq_div_2) >= (xtal_freq_div_2 / 2))
@ -333,16 +332,11 @@ int fc0013_set_params(void *dev, uint32_t freq, uint32_t bandwidth)
reg[2] = pm;
}
if (reg[1] > 15) {
if ((reg[1] > 15) || (reg[2] < 0x0b)) {
fprintf(stderr, "[FC0013] no valid PLL combination "
"found for %u Hz!\n", freq);
return -1;
}
} else {
/* fix for frequency less than 45 MHz */
reg[1] = 0x06;
reg[2] = 0x11;
}
/* fix clock out */
reg[6] |= 0x20;

Loading…
Cancel
Save