diff options
Diffstat (limited to 'drivers/media/video/tea5767.c')
-rw-r--r-- | drivers/media/video/tea5767.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c index 4d27ac1b7fb8..cebcc1fa68d1 100644 --- a/drivers/media/video/tea5767.c +++ b/drivers/media/video/tea5767.c | |||
@@ -2,7 +2,7 @@ | |||
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.21 2005/07/14 03:06:43 mchehab Exp $ | 5 | * $Id: tea5767.c,v 1.27 2005/07/31 12:10:56 mchehab Exp $ |
6 | * | 6 | * |
7 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) | 7 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) |
8 | * This code is placed under the terms of the GNU General Public License | 8 | * This code is placed under the terms of the GNU General Public License |
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/videodev.h> | 15 | #include <linux/videodev.h> |
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <media/tuner.h> | 17 | #include <media/tuner.h> |
18 | #include <media/tuner.h> | ||
19 | 18 | ||
20 | #define PREFIX "TEA5767 " | 19 | #define PREFIX "TEA5767 " |
21 | 20 | ||
@@ -293,16 +292,16 @@ static int tea5767_stereo(struct i2c_client *c) | |||
293 | 292 | ||
294 | int tea5767_autodetection(struct i2c_client *c) | 293 | int tea5767_autodetection(struct i2c_client *c) |
295 | { | 294 | { |
296 | unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff }; | 295 | unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
297 | int rc; | 296 | int rc; |
298 | struct tuner *t = i2c_get_clientdata(c); | 297 | struct tuner *t = i2c_get_clientdata(c); |
299 | 298 | ||
300 | if (5 != (rc = i2c_master_recv(c, buffer, 5))) { | 299 | if (7 != (rc = i2c_master_recv(c, buffer, 7))) { |
301 | tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); | 300 | tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); |
302 | return EINVAL; | 301 | return EINVAL; |
303 | } | 302 | } |
304 | 303 | ||
305 | /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */ | 304 | /* If all bytes are the same then it's a TV tuner and not a tea5767 */ |
306 | if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && | 305 | if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && |
307 | buffer[0] == buffer[3] && buffer[0] == buffer[4]) { | 306 | buffer[0] == buffer[3] && buffer[0] == buffer[4]) { |
308 | tuner_warn("All bytes are equal. It is not a TEA5767\n"); | 307 | tuner_warn("All bytes are equal. It is not a TEA5767\n"); |
@@ -318,6 +317,17 @@ int tea5767_autodetection(struct i2c_client *c) | |||
318 | tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); | 317 | tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); |
319 | return EINVAL; | 318 | return EINVAL; |
320 | } | 319 | } |
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 | |||
326 | /* It seems that tea5767 returns 0xff after the 5th byte */ | ||
327 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { | ||
328 | tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n"); | ||
329 | return EINVAL; | ||
330 | } | ||
321 | 331 | ||
322 | tuner_warn("TEA5767 detected.\n"); | 332 | tuner_warn("TEA5767 detected.\n"); |
323 | return 0; | 333 | return 0; |
@@ -327,10 +337,8 @@ int tea5767_tuner_init(struct i2c_client *c) | |||
327 | { | 337 | { |
328 | struct tuner *t = i2c_get_clientdata(c); | 338 | struct tuner *t = i2c_get_clientdata(c); |
329 | 339 | ||
330 | if (tea5767_autodetection(c) == EINVAL) | 340 | tuner_info("type set to %d (%s)\n", t->type, |
331 | return EINVAL; | 341 | "Philips TEA5767HN FM Radio"); |
332 | |||
333 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); | ||
334 | strlcpy(c->name, "tea5767", sizeof(c->name)); | 342 | strlcpy(c->name, "tea5767", sizeof(c->name)); |
335 | 343 | ||
336 | t->tv_freq = set_tv_freq; | 344 | t->tv_freq = set_tv_freq; |