diff options
| author | Bertrik Sikken <bertrik@sikken.nl> | 2010-06-21 16:45:15 +0000 |
|---|---|---|
| committer | Bertrik Sikken <bertrik@sikken.nl> | 2010-06-21 16:45:15 +0000 |
| commit | 02e04585bdf1fbd00cf84d2000f59ec198440cb3 (patch) | |
| tree | 2d4440f06f6c52920f2c36bebdea63af364fa568 /firmware/drivers | |
| parent | 9e5846e7fca80c7c9331375a0fc2b1941b8bd459 (diff) | |
| download | rockbox-02e04585bdf1fbd00cf84d2000f59ec198440cb3.zip rockbox-02e04585bdf1fbd00cf84d2000f59ec198440cb3.tar.gz rockbox-02e04585bdf1fbd00cf84d2000f59ec198440cb3.tar.bz2 rockbox-02e04585bdf1fbd00cf84d2000f59ec198440cb3.tar.xz | |
Fix FS #10474 - FM tuner on Gigabeat S fails to tune last frequency on start
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27018 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
| -rw-r--r-- | firmware/drivers/tuner/si4700.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/firmware/drivers/tuner/si4700.c b/firmware/drivers/tuner/si4700.c index 8e43fe6..f9b26be 100644 --- a/firmware/drivers/tuner/si4700.c +++ b/firmware/drivers/tuner/si4700.c @@ -370,19 +370,21 @@ static void si4700_set_frequency(int freq) int space = SYSCONFIG2_SPACEr(cache[SYSCONFIG2]); int band = SYSCONFIG2_BANDr(cache[SYSCONFIG2]); int chan = (freq - bands[band]) / spacings[space]; + int readchan; curr_frequency = freq; - si4700_write_reg(CHANNEL, CHANNEL_CHANw(chan) | CHANNEL_TUNE); - do { /* tuning should be done within 60 ms according to the datasheet */ + si4700_write_reg(CHANNEL, CHANNEL_CHANw(chan) | CHANNEL_TUNE); sleep(HZ * 60 / 1000); - } - while ((si4700_read_reg(STATUSRSSI) & STATUSRSSI_STC) == 0); /* STC high? */ - si4700_write_clear(CHANNEL, CHANNEL_TUNE); /* Set TUNE low */ + /* get tune result */ + readchan = si4700_read_reg(READCHAN) & READCHAN_READCHAN; + + si4700_write_clear(CHANNEL, CHANNEL_TUNE); + } while (!((cache[STATUSRSSI] & STATUSRSSI_STC) && (readchan == chan))); } static int si4700_tuned(void) |