diff options
author | Bertrik Sikken <bertrik@sikken.nl> | 2010-06-15 20:57:48 +0000 |
---|---|---|
committer | Bertrik Sikken <bertrik@sikken.nl> | 2010-06-15 20:57:48 +0000 |
commit | fcea117d21102383b35124a9e2513a51971a3fb5 (patch) | |
tree | ed21491ee9b061dedd07908a939a2e3eff2f0149 /firmware/drivers/tuner/si4700.c | |
parent | 267a446887dbeafe02a4e1991af4489979fbb044 (diff) | |
download | rockbox-fcea117d21102383b35124a9e2513a51971a3fb5.tar.gz rockbox-fcea117d21102383b35124a9e2513a51971a3fb5.zip |
Support for mystery FM chip in some Sansa Clip+, FS #11403 by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26864 a1c6a512-1295-4272-9138-f99709370657
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) |