diff options
author | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2005-09-09 16:03:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 16:57:49 -0400 |
commit | 793cf9e6a54c698e109a599c8b8e303658fcaae6 (patch) | |
tree | 522a88bad46df318b04888bad91c49504d3565eb /drivers/media/video/tea5767.c | |
parent | a1938038dd7e4188a8663e49242fa77dd2adb7ed (diff) |
[PATCH] v4l: common part Updates and tuner additions
- Remove $Id CVS logs for V4L files
- Included newer cards.
- Added a new NEC protocol for ir based on pulse distance.
- Enable ATSC support for DViCO FusionHDTV5 Gold.
- Added tuner LG NTSC (TALN mini series).
- Fixed tea5767 autodetection.
- Resolve more tuner types.
- Commented debug function removed from mainstream.
- Remove comments from mainstream. Still on development tree.
- linux/version dependencies removed.
- BTSC Lang1 now is set to auto_stereo mode.
- New tuner standby API.
- i2c-core.c uses hexadecimal for the i2c address, so it should stay consistent.
Signed-off-by: Uli Luckas <luckas@musoft.de>
Signed-off-by: Mac Michaels <wmichaels1@earthlink.net>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: Hermann Pitton <hermann.pitton@onlinehome.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/tea5767.c')
-rw-r--r-- | drivers/media/video/tea5767.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c index cebcc1fa68d1..38bf50943798 100644 --- a/drivers/media/video/tea5767.c +++ b/drivers/media/video/tea5767.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview | 2 | * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview |
3 | * I2C address is allways 0xC0. | 3 | * I2C address is allways 0xC0. |
4 | * | 4 | * |
5 | * $Id: tea5767.c,v 1.27 2005/07/31 12:10:56 mchehab Exp $ | ||
6 | * | 5 | * |
7 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) | 6 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) |
8 | * This code is placed under the terms of the GNU General Public License | 7 | * This code is placed under the terms of the GNU General Public License |
@@ -205,11 +204,6 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq) | |||
205 | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; | 204 | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; |
206 | buffer[4] = 0; | 205 | buffer[4] = 0; |
207 | 206 | ||
208 | if (t->mode == T_STANDBY) { | ||
209 | tuner_dbg("TEA5767 set to standby mode\n"); | ||
210 | buffer[3] |= TEA5767_STDBY; | ||
211 | } | ||
212 | |||
213 | if (t->audmode == V4L2_TUNER_MODE_MONO) { | 207 | if (t->audmode == V4L2_TUNER_MODE_MONO) { |
214 | tuner_dbg("TEA5767 set to mono\n"); | 208 | tuner_dbg("TEA5767 set to mono\n"); |
215 | buffer[2] |= TEA5767_MONO; | 209 | buffer[2] |= TEA5767_MONO; |
@@ -290,13 +284,31 @@ static int tea5767_stereo(struct i2c_client *c) | |||
290 | return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0); | 284 | return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0); |
291 | } | 285 | } |
292 | 286 | ||
287 | static void tea5767_standby(struct i2c_client *c) | ||
288 | { | ||
289 | unsigned char buffer[5]; | ||
290 | struct tuner *t = i2c_get_clientdata(c); | ||
291 | unsigned div, rc; | ||
292 | |||
293 | div = (87500 * 4 + 700 + 225 + 25) / 50; /* Set frequency to 87.5 MHz */ | ||
294 | buffer[0] = (div >> 8) & 0x3f; | ||
295 | buffer[1] = div & 0xff; | ||
296 | buffer[2] = TEA5767_PORT1_HIGH; | ||
297 | buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | | ||
298 | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND | TEA5767_STDBY; | ||
299 | buffer[4] = 0; | ||
300 | |||
301 | if (5 != (rc = i2c_master_send(c, buffer, 5))) | ||
302 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); | ||
303 | } | ||
304 | |||
293 | int tea5767_autodetection(struct i2c_client *c) | 305 | int tea5767_autodetection(struct i2c_client *c) |
294 | { | 306 | { |
295 | unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 307 | unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
296 | int rc; | 308 | int rc; |
297 | struct tuner *t = i2c_get_clientdata(c); | 309 | struct tuner *t = i2c_get_clientdata(c); |
298 | 310 | ||
299 | if (7 != (rc = i2c_master_recv(c, buffer, 7))) { | 311 | if ((rc = i2c_master_recv(c, buffer, 7))< 5) { |
300 | tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); | 312 | tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); |
301 | return EINVAL; | 313 | return EINVAL; |
302 | } | 314 | } |
@@ -313,15 +325,10 @@ int tea5767_autodetection(struct i2c_client *c) | |||
313 | * bit 0 : internally set to 0 | 325 | * bit 0 : internally set to 0 |
314 | * Byte 5: bit 7:0 : == 0 | 326 | * Byte 5: bit 7:0 : == 0 |
315 | */ | 327 | */ |
316 | if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) { | 328 | if (((buffer[3] & 0x0f) != 0x00) || (buffer[4] != 0x00)) { |
317 | tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); | 329 | tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); |
318 | return EINVAL; | 330 | return EINVAL; |
319 | } | 331 | } |
320 | /* It seems that tea5767 returns 0xff after the 5th byte */ | ||
321 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { | ||
322 | tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n"); | ||
323 | return EINVAL; | ||
324 | } | ||
325 | 332 | ||
326 | /* It seems that tea5767 returns 0xff after the 5th byte */ | 333 | /* It seems that tea5767 returns 0xff after the 5th byte */ |
327 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { | 334 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { |
@@ -337,14 +344,14 @@ int tea5767_tuner_init(struct i2c_client *c) | |||
337 | { | 344 | { |
338 | struct tuner *t = i2c_get_clientdata(c); | 345 | struct tuner *t = i2c_get_clientdata(c); |
339 | 346 | ||
340 | tuner_info("type set to %d (%s)\n", t->type, | 347 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); |
341 | "Philips TEA5767HN FM Radio"); | ||
342 | strlcpy(c->name, "tea5767", sizeof(c->name)); | 348 | strlcpy(c->name, "tea5767", sizeof(c->name)); |
343 | 349 | ||
344 | t->tv_freq = set_tv_freq; | 350 | t->tv_freq = set_tv_freq; |
345 | t->radio_freq = set_radio_freq; | 351 | t->radio_freq = set_radio_freq; |
346 | t->has_signal = tea5767_signal; | 352 | t->has_signal = tea5767_signal; |
347 | t->is_stereo = tea5767_stereo; | 353 | t->is_stereo = tea5767_stereo; |
354 | t->standby = tea5767_standby; | ||
348 | 355 | ||
349 | return (0); | 356 | return (0); |
350 | } | 357 | } |