summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/bt8xx/bttv-i2c.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-09-06 19:04:28 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-09-06 19:04:28 -0300
commit73417c50a08d93d5c209df8a49c8d0a0e0d0dc8b (patch)
tree74414bebe3d0e21fb3e0d00b183d74cf876c5e0c /linux/drivers/media/video/bt8xx/bttv-i2c.c
parent9f9d0d9c21ed8c31ec1672eeb262502af5b1e326 (diff)
downloadmediapointer-dvb-s2-73417c50a08d93d5c209df8a49c8d0a0e0d0dc8b.tar.gz
mediapointer-dvb-s2-73417c50a08d93d5c209df8a49c8d0a0e0d0dc8b.tar.bz2
Improved i2c performance on software bitbang algoritm
From: Mauro Carvalho Chehab <mchehab@infradead.org> Software I2C were using a very conservative value of udelay=16, meaning about 20Kbps. According with Philips I2C datasheet, the i2c should answer well for times at the order of 4.7 us. So, using udelay=5 should work for all devices. After this patch, the speed should be close to 66,67 Kbps, with the current kernel software bitbang, with 30/60 duty cycle. Anyway, added a new parameter (i2c_udelay) that would allow using conservative values, if eventually a hardware doesn't support the datasheet values. Thanks to Jean Delvare <khali@linux-fr.org> for pointing this improvement. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/bt8xx/bttv-i2c.c')
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-i2c.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/linux/drivers/media/video/bt8xx/bttv-i2c.c b/linux/drivers/media/video/bt8xx/bttv-i2c.c
index 0558ee220..a4b9e9f81 100644
--- a/linux/drivers/media/video/bt8xx/bttv-i2c.c
+++ b/linux/drivers/media/video/bt8xx/bttv-i2c.c
@@ -8,6 +8,9 @@
& Marcus Metzler (mocm@thp.uni-koeln.de)
(c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
+ (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org>
+ - Multituner support and i2c address binding
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -47,10 +50,18 @@ static int i2c_debug;
static int i2c_hw;
static int i2c_scan;
module_param(i2c_debug, int, 0644);
+MODULE_PARM_DESC(i2c_hw,"configure i2c debug level");
module_param(i2c_hw, int, 0444);
+MODULE_PARM_DESC(i2c_hw,"force use of hardware i2c support, "
+ "instead of software bitbang");
module_param(i2c_scan, int, 0444);
MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
+static unsigned int i2c_udelay = 5;
+module_param(i2c_udelay, int, 0444);
+MODULE_PARM_DESC(i2c_udelay,"soft i2c delay at insmod time, in usecs "
+ "(should be 5 or higher). Lower value means higher bus speed.");
+
/* ----------------------------------------------------------------------- */
/* I2C functions - bitbanging adapter (software i2c) */
@@ -440,6 +451,11 @@ int __devinit init_bttv_i2c(struct bttv *btv)
sizeof(bttv_i2c_adap_hw_template));
} else {
/* bt848 */
+ /* Prevents usage of invalid delay values */
+ if (i2c_udelay<5)
+ i2c_udelay=5;
+ bttv_i2c_algo_bit_template.udelay=i2c_udelay;
+
memcpy(&btv->c.i2c_adap, &bttv_i2c_adap_sw_template,
sizeof(bttv_i2c_adap_sw_template));
memcpy(&btv->i2c_algo, &bttv_i2c_algo_bit_template,