Michael Sevakis | 338aa0b | 2007-07-14 11:25:02 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * General tuner functions |
| 10 | * |
| 11 | * Copyright (C) 2007 by Michael Sevakis |
| 12 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 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. |
Michael Sevakis | 338aa0b | 2007-07-14 11:25:02 +0000 | [diff] [blame] | 17 | * |
| 18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 | * KIND, either express or implied. |
| 20 | * |
| 21 | ****************************************************************************/ |
| 22 | #include <stdlib.h> |
| 23 | #include "config.h" |
| 24 | #include "kernel.h" |
| 25 | #include "tuner.h" |
| 26 | #include "fmradio.h" |
| 27 | |
Michael Sevakis | 338aa0b | 2007-07-14 11:25:02 +0000 | [diff] [blame] | 28 | /* General region information */ |
| 29 | const struct fm_region_data fm_region_data[TUNER_NUM_REGIONS] = |
| 30 | { |
| 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 } |
| 35 | }; |
| 36 | |
Michael Sevakis | 680afaf | 2007-07-14 13:41:59 +0000 | [diff] [blame] | 37 | #ifndef SIMULATOR |
| 38 | |
Michael Sevakis | 338aa0b | 2007-07-14 11:25:02 +0000 | [diff] [blame] | 39 | /* Tuner-specific region information */ |
| 40 | |
| 41 | #if (CONFIG_TUNER & LV24020LP) |
| 42 | /* deemphasis setting for region */ |
| 43 | const unsigned char lv24020lp_region_data[TUNER_NUM_REGIONS] = |
| 44 | { |
| 45 | [REGION_EUROPE] = 0, /* 50uS */ |
| 46 | [REGION_US_CANADA] = 1, /* 75uS */ |
| 47 | [REGION_JAPAN] = 0, /* 50uS */ |
| 48 | [REGION_KOREA] = 0, /* 50uS */ |
| 49 | }; |
| 50 | #endif /* (CONFIG_TUNER & LV24020LP) */ |
| 51 | |
| 52 | #if (CONFIG_TUNER & TEA5767) |
| 53 | const struct tea5767_region_data tea5767_region_data[TUNER_NUM_REGIONS] = |
| 54 | { |
| 55 | [REGION_EUROPE] = { 0, 0 }, /* 50uS, US/Europe band */ |
| 56 | [REGION_US_CANADA] = { 1, 0 }, /* 75uS, US/Europe band */ |
| 57 | [REGION_JAPAN] = { 0, 1 }, /* 50uS, Japanese band */ |
| 58 | [REGION_KOREA] = { 0, 0 }, /* 50uS, US/Europe band */ |
| 59 | }; |
| 60 | #endif /* (CONFIG_TUNER & TEA5767) */ |
| 61 | |
Michael Sevakis | 680afaf | 2007-07-14 13:41:59 +0000 | [diff] [blame] | 62 | #ifdef CONFIG_TUNER_MULTI |
| 63 | int (*tuner_set)(int setting, int value); |
| 64 | int (*tuner_get)(int setting); |
Michael Sevakis | dc05124 | 2007-07-14 22:00:50 +0000 | [diff] [blame] | 65 | #define TUNER_TYPE_CASE(type, set, get, ...) \ |
Michael Sevakis | 680afaf | 2007-07-14 13:41:59 +0000 | [diff] [blame] | 66 | case type: \ |
| 67 | tuner_set = set; \ |
| 68 | tuner_get = get; \ |
Michael Sevakis | dc05124 | 2007-07-14 22:00:50 +0000 | [diff] [blame] | 69 | __VA_ARGS__; \ |
Michael Sevakis | 680afaf | 2007-07-14 13:41:59 +0000 | [diff] [blame] | 70 | break; |
| 71 | #else |
Michael Sevakis | dc05124 | 2007-07-14 22:00:50 +0000 | [diff] [blame] | 72 | #define TUNER_TYPE_CASE(type, set, get, ...) \ |
| 73 | __VA_ARGS__; |
Michael Sevakis | 680afaf | 2007-07-14 13:41:59 +0000 | [diff] [blame] | 74 | #endif /* CONFIG_TUNER_MULTI */ |
| 75 | |
Michael Sevakis | 338aa0b | 2007-07-14 11:25:02 +0000 | [diff] [blame] | 76 | void tuner_init(void) |
| 77 | { |
| 78 | #ifdef CONFIG_TUNER_MULTI |
| 79 | switch (tuner_detect_type()) |
| 80 | #endif |
| 81 | { |
| 82 | #if (CONFIG_TUNER & LV24020LP) |
| 83 | TUNER_TYPE_CASE(LV24020LP, |
| 84 | lv24020lp_set, |
| 85 | lv24020lp_get, |
Michael Sevakis | dc05124 | 2007-07-14 22:00:50 +0000 | [diff] [blame] | 86 | lv24020lp_init()) |
Michael Sevakis | 338aa0b | 2007-07-14 11:25:02 +0000 | [diff] [blame] | 87 | #endif |
| 88 | #if (CONFIG_TUNER & TEA5767) |
| 89 | TUNER_TYPE_CASE(TEA5767, |
| 90 | tea5767_set, |
Michael Sevakis | dc05124 | 2007-07-14 22:00:50 +0000 | [diff] [blame] | 91 | tea5767_get) |
Michael Sevakis | 338aa0b | 2007-07-14 11:25:02 +0000 | [diff] [blame] | 92 | #endif |
| 93 | #if (CONFIG_TUNER & S1A0903X01) |
| 94 | TUNER_TYPE_CASE(S1A0903X01, |
| 95 | s1a0903x01_set, |
Michael Sevakis | dc05124 | 2007-07-14 22:00:50 +0000 | [diff] [blame] | 96 | s1a0903x01_get) |
Michael Sevakis | 338aa0b | 2007-07-14 11:25:02 +0000 | [diff] [blame] | 97 | #endif |
| 98 | } |
| 99 | } |
Michael Sevakis | 680afaf | 2007-07-14 13:41:59 +0000 | [diff] [blame] | 100 | |
| 101 | #endif /* SIMULATOR */ |