Don't try to save settings if none available.
[maemo-rb.git] / firmware / tuner.c
blob278584264b8e7d1d6058d8437417de5ac377904e
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 * General tuner functions
11 * Copyright (C) 2007 by Michael Sevakis
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
22 #include <stdlib.h>
23 #include "config.h"
24 #include "kernel.h"
25 #include "tuner.h"
26 #include "fmradio.h"
28 /* General region information */
29 const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS] =
31 [REGION_EUROPE] = { 87500000, 108000000, 100000, 50 },
32 [REGION_US_CANADA] = { 87900000, 107900000, 200000, 75 },
33 [REGION_JAPAN] = { 76000000, 90000000, 100000, 50 },
34 [REGION_KOREA] = { 87500000, 108000000, 200000, 50 },
35 [REGION_ITALY] = { 87500000, 108000000, 50000, 50 },
36 [REGION_OTHER] = { 87500000, 108000000, 50000, 50 }
39 #ifndef SIMULATOR
41 #ifdef CONFIG_TUNER_MULTI
42 int (*tuner_set)(int setting, int value);
43 int (*tuner_get)(int setting);
45 #define TUNER_TYPE_CASE(type, set, get, ...) \
46 case type: \
47 tuner_set = set; \
48 tuner_get = get; \
49 __VA_ARGS__; \
50 break;
51 #else
52 #define TUNER_TYPE_CASE(type, set, get, ...) \
53 __VA_ARGS__;
54 #endif /* CONFIG_TUNER_MULTI */
56 void tuner_init(void)
58 #ifdef CONFIG_TUNER_MULTI
59 switch (tuner_detect_type())
60 #endif
62 #if (CONFIG_TUNER & LV24020LP)
63 TUNER_TYPE_CASE(LV24020LP,
64 lv24020lp_set,
65 lv24020lp_get,
66 lv24020lp_init())
67 #endif
68 #if (CONFIG_TUNER & TEA5760)
69 TUNER_TYPE_CASE(TEA5760,
70 tea5760_set,
71 tea5760_get,
72 tea5760_init())
73 #endif
74 #if (CONFIG_TUNER & TEA5767)
75 TUNER_TYPE_CASE(TEA5767,
76 tea5767_set,
77 tea5767_get,
78 tea5767_init())
79 #endif
80 #if (CONFIG_TUNER & S1A0903X01)
81 TUNER_TYPE_CASE(S1A0903X01,
82 s1a0903x01_set,
83 s1a0903x01_get)
84 #endif
85 #if (CONFIG_TUNER & SI4700)
86 TUNER_TYPE_CASE(SI4700,
87 si4700_set,
88 si4700_get,
89 si4700_init())
90 #endif
91 #if (CONFIG_TUNER & RDA5802)
92 TUNER_TYPE_CASE(RDA5802,
93 rda5802_set,
94 rda5802_get,
95 rda5802_init())
96 #endif
99 #endif /* SIMULATOR */