summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/tea5767.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <devnull@localhost>2005-07-27 10:02:23 +0000
committerMauro Carvalho Chehab <devnull@localhost>2005-07-27 10:02:23 +0000
commitc3919c23e822aeff195a700b79e81afa70a1a758 (patch)
tree62c6bc2723590a304fce667719bedc67294ab229 /linux/drivers/media/video/tea5767.c
parentbfa68ebe9380a8f2246d195fe464409fddb262ab (diff)
downloadmediapointer-dvb-s2-c3919c23e822aeff195a700b79e81afa70a1a758.tar.gz
mediapointer-dvb-s2-c3919c23e822aeff195a700b79e81afa70a1a758.tar.bz2
- tea5767_autodetection improved.
Newer code works with CX88. Should be tested with other chipsets tea5767_tuner_init doesn't probe tuner anymore, allowing forcing tuner to 5767. - Debug messages simplified to allow printing on one 80 char line at newer I2C Recv option. Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'linux/drivers/media/video/tea5767.c')
-rw-r--r--linux/drivers/media/video/tea5767.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/linux/drivers/media/video/tea5767.c b/linux/drivers/media/video/tea5767.c
index 445a6360e..f1c395b2c 100644
--- a/linux/drivers/media/video/tea5767.c
+++ b/linux/drivers/media/video/tea5767.c
@@ -2,7 +2,7 @@
* For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
* I2C address is allways 0xC0.
*
- * $Id: tea5767.c,v 1.24 2005/07/27 02:44:37 mchehab Exp $
+ * $Id: tea5767.c,v 1.25 2005/07/27 10:02:23 mchehab Exp $
*
* Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br)
* This code is placed under the terms of the GNU General Public License
@@ -293,16 +293,19 @@ static int tea5767_stereo(struct i2c_client *c)
int tea5767_autodetection(struct i2c_client *c)
{
- unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff };
- int rc,div;
+ unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ int rc;
struct tuner *t = i2c_get_clientdata(c);
+#if 0 /* Needed if uncomment I2C send code below */
+ int div;
+#endif
if (5 != (rc = i2c_master_recv(c, buffer, 5))) {
tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc);
return EINVAL;
}
- /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */
+ /* If all bytes are the same then it's a TV tuner and not a tea5767 */
if (buffer[0] == buffer[1] && buffer[0] == buffer[2] &&
buffer[0] == buffer[3] && buffer[0] == buffer[4]) {
tuner_warn("All bytes are equal. It is not a TEA5767\n");
@@ -318,8 +321,15 @@ int tea5767_autodetection(struct i2c_client *c)
tuner_warn("Chip ID is not zero. It is not a TEA5767\n");
return EINVAL;
}
+#if 1 /* On CX88, this works. Must be tested with other chipsets */
+ /* It seems that tea5767 returns 0xff after the 5th byte */
+ if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) {
+ tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n");
+ return EINVAL;
+ }
+#endif
-#if 0
+#if 0 /*Sometimes, this code doesn't work */
/* Sets tuner at some freq (87.5 MHz) and see if it is ok */
div = ((87500 * 4000 + 700000 + 225000) + 16768) >> 15;
buffer[0] = ((div >> 8) & 0x3f) | TEA5767_MUTE;
@@ -355,9 +365,10 @@ int tea5767_tuner_init(struct i2c_client *c)
{
struct tuner *t = i2c_get_clientdata(c);
+#if 0 /* By removing autodetection allows forcing TEA chip */
if (tea5767_autodetection(c) == EINVAL)
return EINVAL;
-
+#endif
tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio");
strlcpy(c->name, "tea5767", sizeof(c->name));