Can you (and anyone else with tveeprom problems) try the following:
Tf you are running ivtv-0.6, then you need to apply the attached patch
to ivtv and recompile/install. It's not needed for ivtv-0.4.5.
Next add the newi2c=0 ivtv module option. Now load ivtv and see if this
makes any difference.
Please let me know what the result is.
Thanks,
Hans
On Thursday 01 June 2006 21:28, Simon Baxter wrote:
> I'm now running kernel 2.6.17-rc5, which included a bunch of patches
> relating to v4l and i2c, and have upgraded to GCC 4.1.1. Then
> recompiled the ivtv and v4l-dvb sources from svn. I'm tempting fate
> saying this, but seem to be experiencing a period of stability -
> except for a couple of errors around:
> tveeprom 0-0050: Encountered bad packet header [ff]. Corrupt or not a
> Hauppauge eeprom.
>
>
>
> Biggest difference I've noticed with this combination is the order
> the i2c devices appear on the bus. In 2.6.16.XXX and GCC 4.1.0, they
> were: Installed I2C busses:
> i2c-1 unknown ivtv i2c driver #0
> Algorithm unavailable
> i2c-0 unknown SMBus Via Pro adapter at 5000
> Algorithm unavailable
>
>
>
> with 2.6.17-rc5 and GCC 4.1.1 they're:
> Installed I2C busses:
> i2c-1 unknown SMBus Via Pro adapter at 5000
> Algorithm unavailable
> i2c-0 unknown ivtv i2c driver #0
> Algorithm unavailable
>
>
>
> _______________________________________________
> ivtv-devel mailing list
> [email protected]
> http://ivtvdriver.org/mailman/listinfo/ivtv-devel
Index: driver/ivtv-i2c.c
===================================================================
--- driver/ivtv-i2c.c (revision 3304)
+++ driver/ivtv-i2c.c (working copy)
@@ -470,8 +470,72 @@
#endif
#endif
};
+static void ivtv_setscl_old(void *data, int state)
+{
+ struct ivtv *itv = (struct ivtv *)data;
+ if (state)
+ itv->i2c_state |= 0x01;
+ else
+ itv->i2c_state &= ~0x01;
+ /* write them out */
+ /* write bits are inverted */
+ writel(~itv->i2c_state, itv->reg_mem + IVTV_REG_I2C_SETSCL_OFFSET);
+}
+
+static void ivtv_setsda_old(void *data, int state)
+{
+ struct ivtv *itv = (struct ivtv *)data;
+
+ if (state)
+ itv->i2c_state |= 0x01;
+ else
+ itv->i2c_state &= ~0x01;
+
+ /* write them out */
+ /* write bits are inverted */
+ writel(~itv->i2c_state, itv->reg_mem + IVTV_REG_I2C_SETSDA_OFFSET);
+}
+
+static int ivtv_getscl_old(void *data)
+{
+ struct ivtv *itv = (struct ivtv *)data;
+
+ return readb(itv->reg_mem + IVTV_REG_I2C_GETSCL_OFFSET);
+}
+
+static int ivtv_getsda_old(void *data)
+{
+ struct ivtv *itv = (struct ivtv *)data;
+
+ return readb(itv->reg_mem + IVTV_REG_I2C_GETSDA_OFFSET);
+}
+
+/* template for i2c-bit-algo */
+static struct i2c_adapter ivtv_i2c_adap_template = {
+ .name = "ivtv i2c driver",
+ .id = I2C_HW_B_BT848, /* algo-bit is OR'd with this */
+ .algo = NULL, /* set by i2c-algo-bit */
+ .algo_data = NULL, /* filled from template */
+ .client_register = attach_inform,
+ .client_unregister = detach_inform,
+/* i2c-2.8.0 and later */
+ .owner = THIS_MODULE,
+ .class = I2C_ADAP_CLASS_TV_ANALOG,
+};
+
+static struct i2c_algo_bit_data ivtv_i2c_algo_template = {
+ NULL, /* ?? */
+ ivtv_setsda_old, /* setsda function */
+ ivtv_setscl_old, /* " */
+ ivtv_getsda_old, /* " */
+ ivtv_getscl_old, /* " */
+ 10, /* udelay or mdelay */
+ 10, /* whatever above isn't */
+ 200 /* timeout */
+};
+
static struct i2c_client ivtv_i2c_client_template = {
.name = "ivtv internal use only",
};
@@ -599,10 +663,19 @@
int __devinit init_ivtv_i2c(struct ivtv *itv)
{
IVTV_DEBUG_I2C("i2c init\n");
-
- memcpy(&itv->i2c_adap, &ivtv_i2c_adap_hw_template,
- sizeof(struct i2c_adapter));
+ if (itv->options.newi2c) {
+ memcpy(&itv->i2c_adap, &ivtv_i2c_adap_hw_template,
+ sizeof(struct i2c_adapter));
+ } else {
+ memcpy(&itv->i2c_adap, &ivtv_i2c_adap_template,
+ sizeof(struct i2c_adapter));
+ memcpy(&itv->i2c_algo, &ivtv_i2c_algo_template,
+ sizeof(struct i2c_algo_bit_data));
+ itv->i2c_algo.data = itv;
+ itv->i2c_adap.algo_data = &itv->i2c_algo;
+ }
+
sprintf(itv->i2c_adap.name + strlen(itv->i2c_adap.name), " #%d",
itv->num);
i2c_set_adapdata(&itv->i2c_adap, itv);
@@ -615,12 +688,19 @@
ivtv_setscl(itv, 1);
ivtv_setsda(itv, 1);
- return i2c_add_adapter(&itv->i2c_adap);
+ if (itv->options.newi2c)
+ return i2c_add_adapter(&itv->i2c_adap);
+ else
+ return i2c_bit_add_bus(&itv->i2c_adap);
}
void __devexit exit_ivtv_i2c(struct ivtv *itv)
{
IVTV_DEBUG_I2C("i2c exit\n");
- i2c_del_adapter(&itv->i2c_adap);
+ if (itv->options.newi2c) {
+ i2c_del_adapter(&itv->i2c_adap);
+ } else {
+ i2c_bit_del_bus(&itv->i2c_adap);
+ }
}
Index: driver/ivtv-driver.c
===================================================================
--- driver/ivtv-driver.c (revision 3313)
+++ driver/ivtv-driver.c (working copy)
@@ -168,6 +168,8 @@
int ivtv_debug = IVTV_DBGFLG_WARN;
+int newi2c = 1;
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
module_param(yuv_fixup, int, 0644);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10)
@@ -208,6 +210,7 @@
module_param(max_dec_yuv_buffers, int, 0644);
module_param(max_dec_vbi_buffers, int, 0644);
module_param(max_dec_osd_buffers, int, 0644);
+module_param(newi2c, int, 0644);
#else
MODULE_PARM(yuv_fixup, "i");
MODULE_PARM(tuner, "1-" __stringify(IVTV_MAX_CARDS) "i");
@@ -242,7 +245,7 @@
MODULE_PARM(max_dec_yuv_buffers, "i");
MODULE_PARM(max_dec_vbi_buffers, "i");
MODULE_PARM(max_dec_osd_buffers, "i");
-
+MODULE_PARM(newi2c, "i");
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */
MODULE_PARM_DESC(yuv_fixup,
@@ -349,6 +352,10 @@
"Max Dec OSD Buffers (in megs)\n"
"\t\t\tDefault: " IVTV_MAX_DEC_OSD_BUFFERS_CNT);
+MODULE_PARM_DESC(newi2c,
+ "Use new I2C implementation\n"
+ "\t\t\t default is 1 (yes)");
+
MODULE_PARM_DESC(ivtv_first_minor, "Set minor assigned to first card");
MODULE_AUTHOR("Kevin Thayer, Chris Kennedy, Hans Verkuil");
@@ -648,6 +655,7 @@
itv->options.tuner = tuner[itv->num];
itv->options.radio = radio[itv->num];
itv->options.dynbuf = ivtv_dynbuf;
+ itv->options.newi2c = newi2c;
itv->has_cx23415 = (itv->dev->device == PCI_DEVICE_ID_IVTV15);
chipname = itv->has_cx23415 ? "cx23415" : "cx23416";
Index: driver/ivtv-driver.h
===================================================================
--- driver/ivtv-driver.h (revision 3304)
+++ driver/ivtv-driver.h (working copy)
@@ -570,6 +570,7 @@
int tuner; /* set tuner on load */
int radio; /* enable/disable radio */
int dynbuf; /* Enable/Disable dynamic buffers */
+ int newi2c; /* New I2C algorithm */
};
struct ivtv_dec_options {
@@ -994,8 +995,10 @@
/* i2c */
struct i2c_adapter i2c_adap;
+ struct i2c_algo_bit_data i2c_algo;
struct i2c_client i2c_client;
struct semaphore i2c_bus_lock;
+ int i2c_state;
struct i2c_client *i2c_clients[I2C_CLIENTS_MAX];
/* v4l2 and User settings */
_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel