diff options
Diffstat (limited to 'firmware/drivers/tuner/si4700.c')
-rw-r--r-- | firmware/drivers/tuner/si4700.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/firmware/drivers/tuner/si4700.c b/firmware/drivers/tuner/si4700.c index 985659b77b..8e43fe6acc 100644 --- a/firmware/drivers/tuner/si4700.c +++ b/firmware/drivers/tuner/si4700.c | |||
@@ -316,30 +316,39 @@ static void si4700_sleep(int snooze) | |||
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
319 | void si4700_init(void) | 319 | bool si4700_detect(void) |
320 | { | 320 | { |
321 | bool detected; | ||
322 | |||
321 | tuner_power(true); | 323 | tuner_power(true); |
324 | detected = (si4700_read_reg(DEVICEID) == 0x1242); | ||
325 | tuner_power(false); | ||
322 | 326 | ||
323 | /* read all registers */ | 327 | return detected; |
324 | si4700_read(16); | 328 | } |
325 | si4700_sleep(0); | ||
326 | 329 | ||
330 | void si4700_init(void) | ||
331 | { | ||
327 | /* check device id */ | 332 | /* check device id */ |
328 | if (cache[DEVICEID] == 0x1242) | 333 | if (si4700_detect()) { |
329 | { | ||
330 | tuner_present = true; | 334 | tuner_present = true; |
331 | 335 | ||
336 | tuner_power(true); | ||
337 | |||
338 | /* read all registers */ | ||
339 | si4700_read(16); | ||
340 | si4700_sleep(0); | ||
341 | |||
332 | #ifdef USE_INTERNAL_OSCILLATOR | 342 | #ifdef USE_INTERNAL_OSCILLATOR |
333 | /* Enable the internal oscillator | 343 | /* Enable the internal oscillator |
334 | (Si4702-16 needs this register to be initialised to 0x100) */ | 344 | (Si4702-16 needs this register to be initialised to 0x100) */ |
335 | si4700_write_set(TEST1, TEST1_XOSCEN | 0x100); | 345 | si4700_write_set(TEST1, TEST1_XOSCEN | 0x100); |
336 | sleep(HZ/2); | 346 | sleep(HZ/2); |
337 | #endif | 347 | #endif |
338 | } | ||
339 | 348 | ||
340 | si4700_sleep(1); | 349 | si4700_sleep(1); |
341 | 350 | tuner_power(false); | |
342 | tuner_power(false); | 351 | } |
343 | } | 352 | } |
344 | 353 | ||
345 | static void si4700_set_frequency(int freq) | 354 | static void si4700_set_frequency(int freq) |