Set SVN keywords
[maemo-rb.git] / firmware / tuner.c
blobcca5cf2491fc77a6e4ac2b0db4d090f3359e258b
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 },
32 [REGION_US_CANADA] = { 87900000, 107900000, 200000 },
33 [REGION_JAPAN] = { 76000000, 90000000, 100000 },
34 [REGION_KOREA] = { 87500000, 108000000, 200000 },
35 [REGION_ITALY] = { 87500000, 108000000, 50000 },
36 [REGION_OTHER] = { 87500000, 108000000, 50000 }
39 #ifndef SIMULATOR
41 /* Tuner-specific region information */
43 #if (CONFIG_TUNER & LV24020LP)
44 /* deemphasis setting for region */
45 const unsigned char lv24020lp_region_data[TUNER_NUM_REGIONS] =
47 [REGION_EUROPE] = 0, /* 50uS */
48 [REGION_US_CANADA] = 1, /* 75uS */
49 [REGION_JAPAN] = 0, /* 50uS */
50 [REGION_KOREA] = 0, /* 50uS */
51 [REGION_ITALY] = 0, /* 50uS */
52 [REGION_OTHER] = 0, /* 50uS */
54 #endif /* (CONFIG_TUNER & LV24020LP) */
56 #if (CONFIG_TUNER & TEA5760)
57 const struct tea5760_region_data tea5760_region_data[TUNER_NUM_REGIONS] =
59 [REGION_EUROPE] = { 1, 0 }, /* 50uS, US/Europe band */
60 [REGION_US_CANADA] = { 0, 0 }, /* 75uS, US/Europe band */
61 [REGION_JAPAN] = { 1, 1 }, /* 50uS, Japanese band */
62 [REGION_KOREA] = { 1, 0 }, /* 50uS, US/Europe band */
63 [REGION_ITALY] = { 1, 0 }, /* 50uS, US/Europe band */
64 [REGION_OTHER] = { 1, 0 }, /* 50uS, US/Europe band */
66 #endif /* (CONFIG_TUNER & TEA5760) */
68 #if (CONFIG_TUNER & TEA5767)
69 const struct tea5767_region_data tea5767_region_data[TUNER_NUM_REGIONS] =
71 [REGION_EUROPE] = { 0, 0 }, /* 50uS, US/Europe band */
72 [REGION_US_CANADA] = { 1, 0 }, /* 75uS, US/Europe band */
73 [REGION_JAPAN] = { 0, 1 }, /* 50uS, Japanese band */
74 [REGION_KOREA] = { 0, 0 }, /* 50uS, US/Europe band */
75 [REGION_ITALY] = { 0, 0 }, /* 50uS, US/Europe band */
76 [REGION_OTHER] = { 0, 0 }, /* 50uS, US/Europe band */
78 #endif /* (CONFIG_TUNER & TEA5767) */
80 #if (CONFIG_TUNER & SI4700)
81 const struct si4700_region_data si4700_region_data[TUNER_NUM_REGIONS] =
83 [REGION_EUROPE] = { 1, 0, 1 }, /* 50uS, US/Europe band, 100kHz spacing */
84 [REGION_US_CANADA] = { 0, 0, 0 }, /* 75uS, US/Europe band, 200kHz spacing */
85 [REGION_JAPAN] = { 1, 2, 1 }, /* 50uS, Japanese band, 100kHz spacing */
86 [REGION_KOREA] = { 1, 0, 0 }, /* 50uS, US/Europe band, 200kHz spacing */
87 [REGION_ITALY] = { 1, 0, 2 }, /* 50uS, US/Europe band, 50kHz spacing */
88 [REGION_OTHER] = { 1, 0, 2 }, /* 50uS, US/Europe band, 50kHz spacing */
90 #endif /* (CONFIG_TUNER & SI4700) */
92 #if (CONFIG_TUNER & IPOD_REMOTE_TUNER)
93 const struct rmt_tuner_region_data
94 rmt_tuner_region_data[TUNER_NUM_REGIONS] =
96 [REGION_EUROPE] = { 1, 0, 1 }, /* 50uS, US/Europe band, 100kHz spacing */
97 [REGION_US_CANADA] = { 0, 0, 0 }, /* 75uS, US/Europe band, 200kHz spacing */
98 [REGION_JAPAN] = { 1, 2, 1 }, /* 50uS, Japanese band, 100kHz spacing */
99 [REGION_KOREA] = { 1, 0, 0 }, /* 50uS, US/Europe band, 200kHz spacing */
100 [REGION_ITALY] = { 1, 0, 2 }, /* 50uS, US/Europe band, 50kHz spacing */
101 [REGION_OTHER] = { 1, 0, 2 }, /* 50uS, US/Europe band, 50kHz spacing */
103 #endif /* (CONFIG_TUNER & IPOD_REMOTE_TUNER) */
105 #ifdef CONFIG_TUNER_MULTI
106 int (*tuner_set)(int setting, int value);
107 int (*tuner_get)(int setting);
109 #define TUNER_TYPE_CASE(type, set, get, ...) \
110 case type: \
111 tuner_set = set; \
112 tuner_get = get; \
113 __VA_ARGS__; \
114 break;
115 #else
116 #define TUNER_TYPE_CASE(type, set, get, ...) \
117 __VA_ARGS__;
118 #endif /* CONFIG_TUNER_MULTI */
120 void tuner_init(void)
122 #ifdef CONFIG_TUNER_MULTI
123 switch (tuner_detect_type())
124 #endif
126 #if (CONFIG_TUNER & LV24020LP)
127 TUNER_TYPE_CASE(LV24020LP,
128 lv24020lp_set,
129 lv24020lp_get,
130 lv24020lp_init())
131 #endif
132 #if (CONFIG_TUNER & TEA5760)
133 TUNER_TYPE_CASE(TEA5760,
134 tea5760_set,
135 tea5760_get,
136 tea5760_init())
137 #endif
138 #if (CONFIG_TUNER & TEA5767)
139 TUNER_TYPE_CASE(TEA5767,
140 tea5767_set,
141 tea5767_get)
142 #endif
143 #if (CONFIG_TUNER & S1A0903X01)
144 TUNER_TYPE_CASE(S1A0903X01,
145 s1a0903x01_set,
146 s1a0903x01_get)
147 #endif
148 #if (CONFIG_TUNER & SI4700)
149 TUNER_TYPE_CASE(SI4700,
150 si4700_set,
151 si4700_get,
152 si4700_init())
153 #endif
156 #endif /* SIMULATOR */