diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-01-15 12:04:52 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-15 18:25:32 -0500 |
commit | 27487d44712aaa37710cc508d5bd6119f5e9f976 (patch) | |
tree | 474acfb51469cc730cd76ebdf6f34680b3809442 /drivers/media/video/tea5767.c | |
parent | 8f0bb9c069fc487dadebe4cdd1e03f0df5ebf0e6 (diff) |
V4L/DVB (3384): Separate tv & radio freqs, fix cb/freq transmit order for tuners that need this.
- Moved MSP_SET_MATRIX to v4l2-common.h
- Fix typos and integer overflows in tea5767.c
- Split old freq field into a tv_freq and a radio_freq. Prevents
that a radio tuner is initialized with a tv frequency or vice versa.
- When switching to radio mode initialize the tuner with the last
used radio frequency (this was already done for the TV mode).
As a result of these changes the tuner module now remembers the
last set radio and TV frequencies, which is what you would expect
to happen.
- Move out of range frequencies to the closest valid frequency as per
v4l2 API spec.
- Fix incorrect initial radio frequency (multiplier is 16000, not 16)
- Add boundary check for out of range frequencies.
- Use new flag to check if the order of the CB and freq. depends on
the last set frequency. That is needed for some tuners or you can
get static as a result. The flag is added for those tuners where I know
that the datasheet indicates that this is necessary.
- For this new check use the last set div value, not the last frequency
as radio frequencies are always much higher due to the 16000 multiplier.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tea5767.c')
-rw-r--r-- | drivers/media/video/tea5767.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c index 921fe72f23d5..c2b98f81c192 100644 --- a/drivers/media/video/tea5767.c +++ b/drivers/media/video/tea5767.c | |||
@@ -62,7 +62,7 @@ extern int tuner_debug; | |||
62 | 62 | ||
63 | #define TEA5767_PORT1_HIGH 0x01 | 63 | #define TEA5767_PORT1_HIGH 0x01 |
64 | 64 | ||
65 | /* Forth register */ | 65 | /* Fourth register */ |
66 | #define TEA5767_PORT2_HIGH 0x80 | 66 | #define TEA5767_PORT2_HIGH 0x80 |
67 | /* Chips stops working. Only I2C bus remains on */ | 67 | /* Chips stops working. Only I2C bus remains on */ |
68 | #define TEA5767_STDBY 0x40 | 68 | #define TEA5767_STDBY 0x40 |
@@ -85,7 +85,7 @@ extern int tuner_debug; | |||
85 | /* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */ | 85 | /* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */ |
86 | #define TEA5767_SRCH_IND 0x01 | 86 | #define TEA5767_SRCH_IND 0x01 |
87 | 87 | ||
88 | /* Fiveth register */ | 88 | /* Fifth register */ |
89 | 89 | ||
90 | /* By activating, it will use Xtal at 13 MHz as reference for divider */ | 90 | /* By activating, it will use Xtal at 13 MHz as reference for divider */ |
91 | #define TEA5767_PLLREF_ENABLE 0x80 | 91 | #define TEA5767_PLLREF_ENABLE 0x80 |
@@ -109,13 +109,13 @@ extern int tuner_debug; | |||
109 | #define TEA5767_STEREO_MASK 0x80 | 109 | #define TEA5767_STEREO_MASK 0x80 |
110 | #define TEA5767_IF_CNTR_MASK 0x7f | 110 | #define TEA5767_IF_CNTR_MASK 0x7f |
111 | 111 | ||
112 | /* Four register */ | 112 | /* Fourth register */ |
113 | #define TEA5767_ADC_LEVEL_MASK 0xf0 | 113 | #define TEA5767_ADC_LEVEL_MASK 0xf0 |
114 | 114 | ||
115 | /* should be 0 */ | 115 | /* should be 0 */ |
116 | #define TEA5767_CHIP_ID_MASK 0x0f | 116 | #define TEA5767_CHIP_ID_MASK 0x0f |
117 | 117 | ||
118 | /* Fiveth register */ | 118 | /* Fifth register */ |
119 | /* Reserved for future extensions */ | 119 | /* Reserved for future extensions */ |
120 | #define TEA5767_RESERVED_MASK 0xff | 120 | #define TEA5767_RESERVED_MASK 0xff |
121 | 121 | ||
@@ -220,19 +220,19 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq) | |||
220 | tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); | 220 | tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); |
221 | buffer[2] |= TEA5767_HIGH_LO_INJECT; | 221 | buffer[2] |= TEA5767_HIGH_LO_INJECT; |
222 | buffer[4] |= TEA5767_PLLREF_ENABLE; | 222 | buffer[4] |= TEA5767_PLLREF_ENABLE; |
223 | div = (frq * 4000 / 16 + 700000 + 225000 + 25000) / 50000; | 223 | div = (frq * (4000 / 16) + 700000 + 225000 + 25000) / 50000; |
224 | break; | 224 | break; |
225 | case TEA5767_LOW_LO_13MHz: | 225 | case TEA5767_LOW_LO_13MHz: |
226 | tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); | 226 | tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); |
227 | 227 | ||
228 | buffer[4] |= TEA5767_PLLREF_ENABLE; | 228 | buffer[4] |= TEA5767_PLLREF_ENABLE; |
229 | div = (frq * 4000 / 16 - 700000 - 225000 + 25000) / 50000; | 229 | div = (frq * (4000 / 16) - 700000 - 225000 + 25000) / 50000; |
230 | break; | 230 | break; |
231 | case TEA5767_LOW_LO_32768: | 231 | case TEA5767_LOW_LO_32768: |
232 | tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); | 232 | tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); |
233 | buffer[3] |= TEA5767_XTAL_32768; | 233 | buffer[3] |= TEA5767_XTAL_32768; |
234 | /* const 700=4000*175 Khz - to adjust freq to right value */ | 234 | /* const 700=4000*175 Khz - to adjust freq to right value */ |
235 | div = ((frq * 4000 / 16 - 700000 - 225000) + 16384) >> 15; | 235 | div = ((frq * (4000 / 16) - 700000 - 225000) + 16384) >> 15; |
236 | break; | 236 | break; |
237 | case TEA5767_HIGH_LO_32768: | 237 | case TEA5767_HIGH_LO_32768: |
238 | default: | 238 | default: |
@@ -350,8 +350,8 @@ int tea5767_tuner_init(struct i2c_client *c) | |||
350 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); | 350 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); |
351 | strlcpy(c->name, "tea5767", sizeof(c->name)); | 351 | strlcpy(c->name, "tea5767", sizeof(c->name)); |
352 | 352 | ||
353 | t->tv_freq = set_tv_freq; | 353 | t->set_tv_freq = set_tv_freq; |
354 | t->radio_freq = set_radio_freq; | 354 | t->set_radio_freq = set_radio_freq; |
355 | t->has_signal = tea5767_signal; | 355 | t->has_signal = tea5767_signal; |
356 | t->is_stereo = tea5767_stereo; | 356 | t->is_stereo = tea5767_stereo; |
357 | t->standby = tea5767_standby; | 357 | t->standby = tea5767_standby; |