FS#8961 - Anti-Aliased Fonts.
[kugel-rb.git] / firmware / tuner.c
bloba471c4e9709b1b34cc01c98ed01c433f241d8b02
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, 50000 },
32 [REGION_US_CANADA] = { 87900000, 107900000, 200000 },
33 [REGION_JAPAN] = { 76000000, 90000000, 100000 },
34 [REGION_KOREA] = { 87500000, 108000000, 100000 }
37 #ifndef SIMULATOR
39 /* Tuner-specific region information */
41 #if (CONFIG_TUNER & LV24020LP)
42 /* deemphasis setting for region */
43 const unsigned char lv24020lp_region_data[TUNER_NUM_REGIONS] =
45 [REGION_EUROPE] = 0, /* 50uS */
46 [REGION_US_CANADA] = 1, /* 75uS */
47 [REGION_JAPAN] = 0, /* 50uS */
48 [REGION_KOREA] = 0, /* 50uS */
50 #endif /* (CONFIG_TUNER & LV24020LP) */
52 #if (CONFIG_TUNER & TEA5760)
53 const struct tea5760_region_data tea5760_region_data[TUNER_NUM_REGIONS] =
55 [REGION_EUROPE] = { 1, 0 }, /* 50uS, US/Europe band */
56 [REGION_US_CANADA] = { 0, 0 }, /* 75uS, US/Europe band */
57 [REGION_JAPAN] = { 1, 1 }, /* 50uS, Japanese band */
58 [REGION_KOREA] = { 1, 0 }, /* 50uS, US/Europe band */
60 #endif /* (CONFIG_TUNER & TEA5760) */
62 #if (CONFIG_TUNER & TEA5767)
63 const struct tea5767_region_data tea5767_region_data[TUNER_NUM_REGIONS] =
65 [REGION_EUROPE] = { 0, 0 }, /* 50uS, US/Europe band */
66 [REGION_US_CANADA] = { 1, 0 }, /* 75uS, US/Europe band */
67 [REGION_JAPAN] = { 0, 1 }, /* 50uS, Japanese band */
68 [REGION_KOREA] = { 0, 0 }, /* 50uS, US/Europe band */
70 #endif /* (CONFIG_TUNER & TEA5767) */
72 #if (CONFIG_TUNER & SI4700)
73 const struct si4700_region_data si4700_region_data[TUNER_NUM_REGIONS] =
75 [REGION_EUROPE] = { 1, 0, 2 }, /* 50uS, US/Europe band, 50kHz spacing */
76 [REGION_US_CANADA] = { 0, 0, 0 }, /* 75uS, US/Europe band, 200kHz spacing */
77 [REGION_JAPAN] = { 1, 2, 1 }, /* 50uS, Japanese band, 100kHz spacing */
78 [REGION_KOREA] = { 1, 0, 1 }, /* 50uS, US/Europe band, 100kHz spacing */
80 #endif /* (CONFIG_TUNER & SI4700) */
82 #ifdef CONFIG_TUNER_MULTI
83 int (*tuner_set)(int setting, int value);
84 int (*tuner_get)(int setting);
85 #define TUNER_TYPE_CASE(type, set, get, ...) \
86 case type: \
87 tuner_set = set; \
88 tuner_get = get; \
89 __VA_ARGS__; \
90 break;
91 #else
92 #define TUNER_TYPE_CASE(type, set, get, ...) \
93 __VA_ARGS__;
94 #endif /* CONFIG_TUNER_MULTI */
96 void tuner_init(void)
98 #ifdef CONFIG_TUNER_MULTI
99 switch (tuner_detect_type())
100 #endif
102 #if (CONFIG_TUNER & LV24020LP)
103 TUNER_TYPE_CASE(LV24020LP,
104 lv24020lp_set,
105 lv24020lp_get,
106 lv24020lp_init())
107 #endif
108 #if (CONFIG_TUNER & TEA5760)
109 TUNER_TYPE_CASE(TEA5760,
110 tea5760_set,
111 tea5760_get,
112 tea5760_init())
113 #endif
114 #if (CONFIG_TUNER & TEA5767)
115 TUNER_TYPE_CASE(TEA5767,
116 tea5767_set,
117 tea5767_get)
118 #endif
119 #if (CONFIG_TUNER & S1A0903X01)
120 TUNER_TYPE_CASE(S1A0903X01,
121 s1a0903x01_set,
122 s1a0903x01_get)
123 #endif
124 #if (CONFIG_TUNER & SI4700)
125 TUNER_TYPE_CASE(SI4700,
126 si4700_set,
127 si4700_get,
128 si4700_init())
129 #endif
133 #endif /* SIMULATOR */