summaryrefslogtreecommitdiff
path: root/drivers/media/video/ivtv/ivtv-i2c.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-11-21 01:47:45 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 18:41:55 -0200
commitf412d36a8c9f8e40e057b71e80d534ac388e903e (patch)
tree36f5a0005efce82787a3dc99af8417dee79f0055 /drivers/media/video/ivtv/ivtv-i2c.c
parente45e8f5cee75b0559ce1ca7007b4963b91910fa8 (diff)
V4L/DVB (13442): ivtv: Add module parameter to adjust I2C SCL clock period per board
Add a module parameter to adjust I2C SCL clock period per board. This allows some experimental fine tuning by end users to overcome quirky I2C device problems. Reported-by: "Aleksandr V. Piskunov" <aleksandr.v.piskunov@gmail.com> Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-i2c.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index b9c71e61f7d6..d4cc3365038e 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -564,13 +564,15 @@ static struct i2c_adapter ivtv_i2c_adap_template = {
.owner = THIS_MODULE,
};
+#define IVTV_ALGO_BIT_TIMEOUT (2) /* seconds */
+
static const struct i2c_algo_bit_data ivtv_i2c_algo_template = {
.setsda = ivtv_setsda_old,
.setscl = ivtv_setscl_old,
.getsda = ivtv_getsda_old,
.getscl = ivtv_getscl_old,
- .udelay = 10,
- .timeout = 200,
+ .udelay = IVTV_DEFAULT_I2C_CLOCK_PERIOD / 2, /* microseconds */
+ .timeout = IVTV_ALGO_BIT_TIMEOUT * HZ, /* jiffies */
};
static struct i2c_client ivtv_i2c_client_template = {
@@ -602,6 +604,7 @@ int init_ivtv_i2c(struct ivtv *itv)
memcpy(&itv->i2c_algo, &ivtv_i2c_algo_template,
sizeof(struct i2c_algo_bit_data));
}
+ itv->i2c_algo.udelay = itv->options.i2c_clock_period / 2;
itv->i2c_algo.data = itv;
itv->i2c_adap.algo_data = &itv->i2c_algo;