summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/tea5767.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <devnull@localhost>2005-07-13 10:48:32 +0000
committerMauro Carvalho Chehab <devnull@localhost>2005-07-13 10:48:32 +0000
commit6e0ef61cdbc476b32b2276bbfe20d8ce9476d93d (patch)
tree36381203edd8d3d3fbea0b48a500ce2a7fe5088a /linux/drivers/media/video/tea5767.c
parentaf795ba92eadefa36f3e3046b48a1a6dffeba0fb (diff)
downloadmediapointer-dvb-s2-6e0ef61cdbc476b32b2276bbfe20d8ce9476d93d.tar.gz
mediapointer-dvb-s2-6e0ef61cdbc476b32b2276bbfe20d8ce9476d93d.tar.bz2
* tea5767.c:
- Fixed newer tea autodetection code. * tuner-core.c: - unimplemented IOCTL msg now is clearer for developers. 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.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/linux/drivers/media/video/tea5767.c b/linux/drivers/media/video/tea5767.c
index 6fd8e6300..821c9e676 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.19 2005/07/13 10:06:33 mchehab Exp $
+ * $Id: tea5767.c,v 1.20 2005/07/13 10:48:32 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
@@ -294,7 +294,7 @@ 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;
+ int rc,div;
struct tuner *t = i2c_get_clientdata(c);
if (5 != (rc = i2c_master_recv(c, buffer, 5))) {
@@ -319,11 +319,27 @@ int tea5767_autodetection(struct i2c_client *c)
return EINVAL;
}
+ /* 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;
+ buffer[1] = div & 0xff;
+ buffer[2] = TEA5767_PORT1_HIGH;
+ buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL |
+ TEA5767_ST_NOISE_CTL;
+ buffer[4] = 0;
+
+ if (5 != (rc = i2c_master_send(c, buffer, 5)))
+ tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
+
+ if (5 != (rc = i2c_master_recv(c, buffer, 5))) {
+ tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc);
+ return EINVAL;
+ }
+
/* Initial freq for 32.768KHz clock */
- if ((buffer[0] != 0x29) ||(buffer[1] != 0xd5)) {
- tuner_warn("Maybe it is a TEA5767. Please send debug info to V4L list at video4linux-list@redhat.com\n");
- tuner_warn("Return bytes: %02x %02x %02x %02x %02x\n",
- buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]);
+ if ((buffer[1] != (div & 0xff) ) || ((buffer[0] & 0x3f) != ((div >> 8) & 0x3f))) {
+ tuner_warn("It is not a TEA5767. div=%d, Return: %02x %02x %02x %02x %02x\n",
+ div,buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]);
tea5767_status_dump(buffer);
return EINVAL;
}