aboutsummaryrefslogtreecommitdiffstats
path: root/src/tuner_e4k.c
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2012-05-10 21:07:25 +0200
committerSteve Markgraf <steve@steve-m.de>2012-05-10 21:07:25 +0200
commit2ed8375f39a952f28f1c3f66933ad5eb2774da9b (patch)
tree2959a35dd343be2cd57f98faee289e93ffdcc073 /src/tuner_e4k.c
parent8402124e6f66aa99415e495de67e8021151a25c8 (diff)
tuner_e4k: allow frequencies above INT_MAX
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Diffstat (limited to 'src/tuner_e4k.c')
-rw-r--r--src/tuner_e4k.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tuner_e4k.c b/src/tuner_e4k.c
index 651c626..bc97399 100644
--- a/src/tuner_e4k.c
+++ b/src/tuner_e4k.c
@@ -423,7 +423,7 @@ static uint64_t compute_fvco(uint32_t f_osc, uint8_t z, uint16_t x)
return fvco;
}
-static int compute_flo(uint32_t f_osc, uint8_t z, uint16_t x, uint8_t r)
+static uint32_t compute_flo(uint32_t f_osc, uint8_t z, uint16_t x, uint8_t r)
{
uint64_t fvco = compute_fvco(f_osc, z, x);
if (fvco == 0)
@@ -459,9 +459,9 @@ static int e4k_band_set(struct e4k_state *e4k, enum e4k_band band)
* \param[in] fosc Clock input frequency applied to the chip (Hz)
* \param[in] intended_flo target tuning frequency (Hz)
* \returns actual PLL frequency, as close as possible to intended_flo,
- * negative in case of error
+ * 0 in case of error
*/
-int e4k_compute_pll_params(struct e4k_pll_params *oscp, uint32_t fosc, uint32_t intended_flo)
+uint32_t e4k_compute_pll_params(struct e4k_pll_params *oscp, uint32_t fosc, uint32_t intended_flo)
{
uint32_t i;
uint8_t r = 2;
@@ -473,7 +473,7 @@ int e4k_compute_pll_params(struct e4k_pll_params *oscp, uint32_t fosc, uint32_t
oscp->r_idx = 0;
if (!is_fosc_valid(fosc))
- return -EINVAL;
+ return 0;
for(i = 0; i < ARRAY_SIZE(pll_vars); ++i) {
if(intended_flo < pll_vars[i].freq) {
@@ -556,13 +556,13 @@ int e4k_tune_params(struct e4k_state *e4k, struct e4k_pll_params *p)
*/
int e4k_tune_freq(struct e4k_state *e4k, uint32_t freq)
{
- int rc, i;
+ uint32_t rc;
struct e4k_pll_params p;
/* determine PLL parameters */
rc = e4k_compute_pll_params(&p, e4k->vco.fosc, freq);
- if (rc < 0)
- return rc;
+ if (!rc)
+ return -EINVAL;
/* actually tune to those parameters */
rc = e4k_tune_params(e4k, &p);