diff options
-rw-r--r-- | linux/drivers/media/video/tea5767.c | 28 | ||||
-rw-r--r-- | linux/drivers/media/video/tuner-core.c | 6 | ||||
-rw-r--r-- | v4l/ChangeLog | 9 |
3 files changed, 35 insertions, 8 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; } diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 2b019709b..2b594582a 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -1,5 +1,5 @@ /* - * $Id: tuner-core.c,v 1.55 2005/07/08 13:20:33 mchehab Exp $ + * $Id: tuner-core.c,v 1.56 2005/07/13 10:48:32 mchehab Exp $ * * i2c tv tuner chip device driver * core core, i.e. kernel interfaces, registering and so on @@ -641,7 +641,9 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) break; } default: - tuner_dbg("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); + tuner_dbg("Unimplemented IOCTL 0x%08x(dir=%d,tp=0x%02x,nr=%d,sz=%d)\n", + cmd, _IOC_DIR(cmd), _IOC_TYPE(cmd), + _IOC_NR(cmd), _IOC_SIZE(cmd)); break; } diff --git a/v4l/ChangeLog b/v4l/ChangeLog index 31103a6cb..d7609efd7 100644 --- a/v4l/ChangeLog +++ b/v4l/ChangeLog @@ -1,5 +1,14 @@ 2005-07-13 10:06 mchehab * 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> + +2005-07-13 10:06 mchehab + * tea5767.c: - Improved tea autodetection to avoid troubles with other tuners. - Eliminated some precision small troubles. - Some debug messages fixed. |