summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/tuner/rda5802.c10
-rw-r--r--firmware/drivers/tuner/si4700.c9
2 files changed, 0 insertions, 19 deletions
diff --git a/firmware/drivers/tuner/rda5802.c b/firmware/drivers/tuner/rda5802.c
index 82dc0bbcb9..fe2b25f213 100644
--- a/firmware/drivers/tuner/rda5802.c
+++ b/firmware/drivers/tuner/rda5802.c
@@ -100,7 +100,6 @@ static const uint16_t initvals[16] = {
100}; 100};
101 101
102static bool tuner_present = false; 102static bool tuner_present = false;
103static int curr_frequency = 87500000; /* Current station frequency (HZ) */
104static uint16_t cache[16]; 103static uint16_t cache[16];
105 104
106/* reads <len> registers from radio at offset 0x0A into cache */ 105/* reads <len> registers from radio at offset 0x0A into cache */
@@ -208,8 +207,6 @@ static void rda5802_set_frequency(int freq)
208 int start = CHANNEL_BANDr(cache[CHANNEL]) & 1 ? 76000000 : 87000000; 207 int start = CHANNEL_BANDr(cache[CHANNEL]) & 1 ? 76000000 : 87000000;
209 int chan = (freq - start) / 50000; 208 int chan = (freq - start) / 50000;
210 209
211 curr_frequency = freq;
212
213 for (i = 0; i < 5; i++) { 210 for (i = 0; i < 5; i++) {
214 /* tune and wait a bit */ 211 /* tune and wait a bit */
215 rda5802_write_masked(CHANNEL, CHANNEL_CHANw(chan) | CHANNEL_TUNE, 212 rda5802_write_masked(CHANNEL, CHANNEL_CHANw(chan) | CHANNEL_TUNE,
@@ -250,16 +247,9 @@ static void rda5802_set_region(int region)
250 247
251 uint16_t bandspacing = CHANNEL_BANDw(band) | 248 uint16_t bandspacing = CHANNEL_BANDw(band) |
252 CHANNEL_SPACEw(CHANNEL_SPACE_50KHZ); 249 CHANNEL_SPACEw(CHANNEL_SPACE_50KHZ);
253 uint16_t oldbs = cache[CHANNEL] & (CHANNEL_BAND | CHANNEL_SPACE);
254
255 rda5802_write_masked(SYSCONFIG1, deemphasis, SYSCONFIG1_DE); 250 rda5802_write_masked(SYSCONFIG1, deemphasis, SYSCONFIG1_DE);
256 rda5802_write_masked(CHANNEL, bandspacing, CHANNEL_BAND | CHANNEL_SPACE); 251 rda5802_write_masked(CHANNEL, bandspacing, CHANNEL_BAND | CHANNEL_SPACE);
257 rda5802_write_cache(); 252 rda5802_write_cache();
258
259 /* Retune if this region change would change the channel number. */
260 if (oldbs != bandspacing) {
261 rda5802_set_frequency(curr_frequency);
262 }
263} 253}
264 254
265static bool rda5802_st(void) 255static bool rda5802_st(void)
diff --git a/firmware/drivers/tuner/si4700.c b/firmware/drivers/tuner/si4700.c
index 4747357037..848d25eeb0 100644
--- a/firmware/drivers/tuner/si4700.c
+++ b/firmware/drivers/tuner/si4700.c
@@ -213,7 +213,6 @@ extern int si4700_st(void);
213/* 4702/03: RDS Block A-D data */ 213/* 4702/03: RDS Block A-D data */
214 214
215static bool tuner_present = false; 215static bool tuner_present = false;
216static int curr_frequency = 87500000; /* Current station frequency (HZ) */
217static uint16_t cache[16]; 216static uint16_t cache[16];
218 217
219/* reads <len> registers from radio at offset 0x0A into cache */ 218/* reads <len> registers from radio at offset 0x0A into cache */
@@ -380,8 +379,6 @@ static void si4700_set_frequency(int freq)
380 int chan = (freq - bands[band]) / spacings[space]; 379 int chan = (freq - bands[band]) / spacings[space];
381 int readchan; 380 int readchan;
382 381
383 curr_frequency = freq;
384
385 do 382 do
386 { 383 {
387 /* tuning should be done within 60 ms according to the datasheet */ 384 /* tuning should be done within 60 ms according to the datasheet */
@@ -416,15 +413,9 @@ static void si4700_set_region(int region)
416 413
417 uint16_t bandspacing = SYSCONFIG2_BANDw(band) | 414 uint16_t bandspacing = SYSCONFIG2_BANDw(band) |
418 SYSCONFIG2_SPACEw(spacing); 415 SYSCONFIG2_SPACEw(spacing);
419 uint16_t oldbs = cache[SYSCONFIG2] & (SYSCONFIG2_BAND | SYSCONFIG2_SPACE);
420
421 si4700_write_masked(SYSCONFIG1, deemphasis, SYSCONFIG1_DE); 416 si4700_write_masked(SYSCONFIG1, deemphasis, SYSCONFIG1_DE);
422 si4700_write_masked(SYSCONFIG2, bandspacing, 417 si4700_write_masked(SYSCONFIG2, bandspacing,
423 SYSCONFIG2_BAND | SYSCONFIG2_SPACE); 418 SYSCONFIG2_BAND | SYSCONFIG2_SPACE);
424
425 /* Retune if this region change would change the channel number. */
426 if (oldbs != bandspacing)
427 si4700_set_frequency(curr_frequency);
428} 419}
429 420
430/* tuner abstraction layer: set something to the tuner */ 421/* tuner abstraction layer: set something to the tuner */