diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/tuner/lv24020lp.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/firmware/drivers/tuner/lv24020lp.c b/firmware/drivers/tuner/lv24020lp.c index a53d93bf65..86f8c39593 100644 --- a/firmware/drivers/tuner/lv24020lp.c +++ b/firmware/drivers/tuner/lv24020lp.c | |||
@@ -496,9 +496,25 @@ static int tuner_measure(unsigned char type, int scale, int duration) | |||
496 | 496 | ||
497 | /* start counter, delay for specified time and stop it */ | 497 | /* start counter, delay for specified time and stop it */ |
498 | lv24020lp_write_set(CNT_CTRL, CNT_EN); | 498 | lv24020lp_write_set(CNT_CTRL, CNT_EN); |
499 | udelay(duration*1000 - 16); | 499 | |
500 | #ifdef CPU_PP | ||
501 | /* obtain actual duration, including interrupts that occurred and | ||
502 | * the time to write the counter stop */ | ||
503 | long usec = USEC_TIMER; | ||
504 | #endif | ||
505 | |||
506 | udelay(duration*1000); | ||
507 | |||
500 | lv24020lp_write_clear(CNT_CTRL, CNT_EN); | 508 | lv24020lp_write_clear(CNT_CTRL, CNT_EN); |
501 | 509 | ||
510 | #ifdef CPU_PP | ||
511 | duration = (USEC_TIMER - usec) / 1000; | ||
512 | #endif | ||
513 | |||
514 | /* This function takes a loooong time and other stuff needs | ||
515 | running by now */ | ||
516 | yield(); | ||
517 | |||
502 | /* read tick count */ | 518 | /* read tick count */ |
503 | finval = (lv24020lp_read(CNT_H) << 8) | lv24020lp_read(CNT_L); | 519 | finval = (lv24020lp_read(CNT_H) << 8) | lv24020lp_read(CNT_L); |
504 | 520 | ||
@@ -512,10 +528,6 @@ static int tuner_measure(unsigned char type, int scale, int duration) | |||
512 | else | 528 | else |
513 | finval = scale*finval / duration; | 529 | finval = scale*finval / duration; |
514 | 530 | ||
515 | /* This function takes a loooong time and other stuff needs | ||
516 | running by now */ | ||
517 | yield(); | ||
518 | |||
519 | return (int)finval; | 531 | return (int)finval; |
520 | } | 532 | } |
521 | 533 | ||
@@ -532,6 +544,16 @@ static void set_frequency(int freq) | |||
532 | 544 | ||
533 | enable_afc(false); | 545 | enable_afc(false); |
534 | 546 | ||
547 | /* For the LV2400x, the tuned frequency is the sum of the displayed | ||
548 | * frequency and the preset IF frequency, in formula: | ||
549 | * Tuned FM frequency = displayed frequency + preset IF frequency | ||
550 | * | ||
551 | * For example: when the IF frequency of LV2400x is preset at 110 kHz, | ||
552 | * it must be tuned at 88.51 MHz to receive the radio station at 88.4 MHz. | ||
553 | * -- AN2400S04@ – V0.4 | ||
554 | */ | ||
555 | freq += if_set; | ||
556 | |||
535 | /* MHz -> kHz */ | 557 | /* MHz -> kHz */ |
536 | freq /= 1000; | 558 | freq /= 1000; |
537 | 559 | ||