diff options
author | Marcoen Hirschberg <marcoen@gmail.com> | 2008-03-27 11:53:51 +0000 |
---|---|---|
committer | Marcoen Hirschberg <marcoen@gmail.com> | 2008-03-27 11:53:51 +0000 |
commit | b2ec13d8f1fc44e8e7076808b57b64365714a6f3 (patch) | |
tree | 8c8e716b0ae627a60fc8aebd9e64afd8d8d4e0e3 /firmware/drivers/tuner/tea5760uk.c | |
parent | f8690231bf82cf46b26efe68d4696d1cd18d1737 (diff) | |
download | rockbox-b2ec13d8f1fc44e8e7076808b57b64365714a6f3.tar.gz rockbox-b2ec13d8f1fc44e8e7076808b57b64365714a6f3.zip |
Revert "initial Meizu M6SL port"
This reverts commit b7bd17ce1715c3a8acbf74a63694c28b6075da5b.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16846 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/tuner/tea5760uk.c')
-rw-r--r-- | firmware/drivers/tuner/tea5760uk.c | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/firmware/drivers/tuner/tea5760uk.c b/firmware/drivers/tuner/tea5760uk.c deleted file mode 100644 index 8ac6cb2dbc..0000000000 --- a/firmware/drivers/tuner/tea5760uk.c +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * Tuner "middleware" for Philips TEA5760 chip | ||
10 | * | ||
11 | * Copyright (C) 2004 Jörg Hohensohn | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | #include "config.h" | ||
21 | #include <stdbool.h> | ||
22 | #include <string.h> | ||
23 | #include <stdlib.h> | ||
24 | #include "kernel.h" | ||
25 | #include "tuner.h" /* tuner abstraction interface */ | ||
26 | #include "fmradio.h" | ||
27 | #include "fmradio_i2c.h" /* physical interface driver */ | ||
28 | |||
29 | #define I2C_ADR 0xC0 | ||
30 | static unsigned char write_bytes[7] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
31 | |||
32 | static void tea5760uk_set_clear(int byte, unsigned char bits, int set) | ||
33 | { | ||
34 | write_bytes[byte] &= ~bits; | ||
35 | if (set) | ||
36 | write_bytes[byte] |= bits; | ||
37 | } | ||
38 | |||
39 | /* tuner abstraction layer: set something to the tuner */ | ||
40 | int tea5760uk_set(int setting, int value) | ||
41 | { | ||
42 | switch(setting) | ||
43 | { | ||
44 | case RADIO_SLEEP: | ||
45 | /* init values */ | ||
46 | write_bytes[0] |= (1<<7); /* mute */ | ||
47 | #if CONFIG_TUNER_XTAL == 32768 | ||
48 | /* 32.768kHz, soft mute, stereo noise cancelling */ | ||
49 | write_bytes[3] |= (1<<4) | (1<<3) | (1<<1); | ||
50 | #else | ||
51 | /* soft mute, stereo noise cancelling */ | ||
52 | write_bytes[3] |= (1<<3) | (1<<1); | ||
53 | #endif | ||
54 | /* sleep / standby mode */ | ||
55 | tea5760uk_set_clear(3, (1<<6), value); | ||
56 | break; | ||
57 | |||
58 | case RADIO_FREQUENCY: | ||
59 | { | ||
60 | int n; | ||
61 | #if CONFIG_TUNER_XTAL == 32768 | ||
62 | n = (4 * (value - 225000) + 16384) / 32768; | ||
63 | #else | ||
64 | n = (4 * (value - 225000)) / 50000; | ||
65 | #endif | ||
66 | write_bytes[6] = (write_bytes[6] & 0xC0) | (n >> 8); | ||
67 | write_bytes[7] = n; | ||
68 | } | ||
69 | break; | ||
70 | |||
71 | case RADIO_SCAN_FREQUENCY: | ||
72 | tea5760uk_set(RADIO_FREQUENCY, value); | ||
73 | sleep(HZ/30); | ||
74 | return tea5760uk_get(RADIO_TUNED); | ||
75 | |||
76 | case RADIO_MUTE: | ||
77 | tea5760uk_set_clear(3, (1<<2), value); | ||
78 | break; | ||
79 | |||
80 | case RADIO_REGION: | ||
81 | { | ||
82 | const struct tea5760uk_region_data *rd = | ||
83 | &tea5760uk_region_data[value]; | ||
84 | |||
85 | tea5760uk_set_clear(4, (1<<1), rd->deemphasis); | ||
86 | tea5760uk_set_clear(3, (1<<5), rd->band); | ||
87 | break; | ||
88 | } | ||
89 | case RADIO_FORCE_MONO: | ||
90 | tea5760uk_set_clear(4, (1<<3), value); | ||
91 | break; | ||
92 | default: | ||
93 | return -1; | ||
94 | } | ||
95 | |||
96 | fmradio_i2c_write(I2C_ADR, write_bytes, sizeof(write_bytes)); | ||
97 | return 1; | ||
98 | } | ||
99 | |||
100 | /* tuner abstraction layer: read something from the tuner */ | ||
101 | int tea5760uk_get(int setting) | ||
102 | { | ||
103 | unsigned char read_bytes[16]; | ||
104 | int val = -1; /* default for unsupported query */ | ||
105 | |||
106 | fmradio_i2c_read(I2C_ADR, read_bytes, sizeof(read_bytes)); | ||
107 | |||
108 | switch(setting) | ||
109 | { | ||
110 | case RADIO_PRESENT: | ||
111 | val = 1; /* true */ | ||
112 | break; | ||
113 | |||
114 | case RADIO_TUNED: | ||
115 | val = 0; | ||
116 | if (read_bytes[0] & (1<<4)) /* IF count correct */ | ||
117 | { | ||
118 | val = read_bytes[8] >> 1; /* IF counter */ | ||
119 | val = (abs(val - 0x36) < 2); /* close match */ | ||
120 | } | ||
121 | break; | ||
122 | |||
123 | case RADIO_STEREO: | ||
124 | val = read_bytes[9] >> 2; | ||
125 | break; | ||
126 | } | ||
127 | |||
128 | return val; | ||
129 | } | ||
130 | |||
131 | void tea5760uk_dbg_info(struct tea5760uk_dbg_info *info) | ||
132 | { | ||
133 | fmradio_i2c_read(I2C_ADR, info->read_regs, 5); | ||
134 | memcpy(info->write_regs, write_bytes, 5); | ||
135 | } | ||