Index: linux-2.6.16/drivers/i2c/chips/Makefile
===================================================================
--- linux-2.6.16.orig/drivers/i2c/chips/Makefile	2007-03-17 20:34:51.000000000 -0300
+++ linux-2.6.16/drivers/i2c/chips/Makefile	2007-03-17 20:35:29.000000000 -0300
@@ -17,6 +17,7 @@
 
 obj-$(CONFIG_I2C_ADCM2700)	+= e680_camera.o
 obj-$(CONFIG_I2C_A780_CAMERA)	+= a780_camera.o
+obj-$(CONFIG_I2C_OV9640)	+= i2c-ov9640.o
 //obj-$(CONFIG_PXA_EZX_E680)	+= boomer.o
 
 ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
Index: linux-2.6.16/drivers/i2c/chips/i2c-ov9640.c
===================================================================
--- linux-2.6.16.orig/drivers/i2c/chips/i2c-ov9640.c	2007-03-17 20:34:50.000000000 -0300
+++ linux-2.6.16/drivers/i2c/chips/i2c-ov9640.c	2007-03-17 20:35:29.000000000 -0300
@@ -14,22 +14,24 @@
 extern int i2c_adapter_id(struct i2c_adapter *adap);
 
 int  i2c_ov9640_cleanup(void);
-void i2c_ov9640_inc_use (struct i2c_client *client);
-void i2c_ov9640_dec_use (struct i2c_client *client);
+//void i2c_ov9640_inc_use (struct i2c_client *client);
+//void i2c_ov9640_dec_use (struct i2c_client *client);
 int  i2c_ov9640_attach_adapter(struct i2c_adapter *adapter);
 int  i2c_ov9640_detect_client(struct i2c_adapter *, int, unsigned short, int);
 int  i2c_ov9640_detach_client(struct i2c_client *client);
 
 struct i2c_driver ov9640_driver  = 
 {
-	name:			"ov9640 driver",	            /* name           */
-	id:			I2C_DRIVERID_OV9640,         	    /* id             */
-	flags:			I2C_DF_NOTIFY,        		    /* flags          */
-	attach_adapter:		&i2c_ov9640_attach_adapter,       /* attach_adapter */
-	detach_client:		&i2c_ov9640_detach_client,        /* detach_client  */
-	command:		NULL,
-	inc_use:		&i2c_ov9640_inc_use,
-	dec_use:		&i2c_ov9640_dec_use
+	.driver = {
+		name:			"ov9640 driver",	            /* name           */
+	},
+	.id =			I2C_DRIVERID_OV9640,         	    /* id             */
+//	.flags =			I2C_DF_NOTIFY,        		    /* flags          */
+	.attach_adapter =		&i2c_ov9640_attach_adapter,       /* attach_adapter */
+	.detach_client =		&i2c_ov9640_detach_client,        /* detach_client  */
+	.command =		NULL,
+//	.inc_use =		&i2c_ov9640_inc_use,
+//	.dec_use =		&i2c_ov9640_dec_use
 };
 
 extern  struct i2c_adapter *i2cdev_adaps[];
@@ -44,7 +46,7 @@
  * This call returns a unique low identifier for each registered adapter,
  * or -1 if the adapter was not registered.
  */
-void i2c_ov9640_inc_use (struct i2c_client *client)
+/* void i2c_ov9640_inc_use (struct i2c_client *client)
 {
 	MOD_INC_USE_COUNT;
 #ifdef MODULE
@@ -56,19 +58,19 @@
 	MOD_DEC_USE_COUNT;
 #ifdef MODULE
 #endif
-}
+}*/
 
 char ov9640_read(u8 addr, u8 *pvalue)
 {
 	int	res=0;
 	char 	buf=0;
 	struct i2c_msg msgs[2] = {
-		{ 0, I2C_M_WR, 1, &addr },
-		{ 0, I2C_M_RD, 1, &buf }};
+		{ 0, 0, 1, &addr },
+		{ 0, 1, 1, &buf }};
 	
 	if( g_client == NULL )	
 		return -1;
-	i2c_ov9640_inc_use(g_client);
+//	i2c_ov9640_inc_use(g_client);
 	msgs[0].addr=msgs[1].addr=g_client->addr;
 	res=i2c_transfer(g_client->adapter,&msgs[0],1);
 	if (res<=0) 
@@ -77,7 +79,7 @@
 	if (res<=0) 
 		goto out;
 	*pvalue = buf;
-	i2c_ov9640_dec_use(g_client);
+//	i2c_ov9640_dec_use(g_client);
 out:
 	DPRINTK(KERN_INFO "In funtion %s addr:%x,value=%x\n", __FUNCTION__, addr,*pvalue);
 	if (res<=0) DPRINTK("res = %d \n",res);
@@ -104,9 +106,9 @@
 	res=i2c_smbus_write_byte_data(g_client, addr, value );
 	*/
 	char 	buf[2]={addr,value};
-	i2c_ov9640_inc_use(g_client);
+//	i2c_ov9640_inc_use(g_client);
 	res = i2c_master_send(g_client, buf, 2);
-	i2c_ov9640_dec_use(g_client);
+//	i2c_ov9640_dec_use(g_client);
 	if (res >0) res =0;
 	else res =-1;
 	DPRINTK(KERN_INFO "In funtion %s addr:%x value:%xreturn %d \n", __FUNCTION__, addr,value,res);
@@ -143,7 +145,6 @@
 {
     struct i2c_client *new_client;
     int err = 0;
-    struct ov9640_data *data;
     
     /*check if */
     if(g_client != NULL) {
@@ -168,18 +169,15 @@
        need it, remove it. We do it here to help to lessen memory
        fragmentation. */
 
-    new_client=kmalloc(sizeof(struct i2c_client)+sizeof(struct ov9640_data),
-		  				GFP_KERNEL );
+    new_client=kmalloc(sizeof(struct i2c_client), GFP_KERNEL );
 
     if ( !new_client )  {
       err = -ENOMEM;
       goto ERROR0;
     }
 
-	data = (struct ov9640_data *) (new_client + 1);
 
 	new_client->addr = address;	
-	new_client->data = data;
 	new_client->adapter = adapter;
 	new_client->driver = &ov9640_driver;
 	new_client->flags = 0;
@@ -210,14 +208,6 @@
 	}
 
 	strcpy(new_client->name, "ov9640");
-    /* Automatically unique */
-    new_client->id = ov9640_id++; 
-
-    /* Only if you use this field */
-	data->valid = 0; 
-
-    /* Only if you use this field */
-	init_MUTEX(&data->update_lock); 
 
     /* Tell the i2c layer a new client has arrived */
     if ((err = i2c_attach_client(new_client)))
Index: linux-2.6.16/drivers/i2c/chips/i2c-ov9640.h
===================================================================
--- linux-2.6.16.orig/drivers/i2c/chips/i2c-ov9640.h	2007-03-17 20:34:50.000000000 -0300
+++ linux-2.6.16/drivers/i2c/chips/i2c-ov9640.h	2007-03-17 20:35:29.000000000 -0300
@@ -14,7 +14,7 @@
 // #define SENSOR_SLAVE_ADDR   0x0055      /* tbd: */
 
 
-#define I2C_DRIVERID_OV9640   I2C_DRIVERID_EXP2
+#define I2C_DRIVERID_OV9640   0xf2
 
 /*ov9640 chip id*/
 #define OV9640_CHIP_ID  0x9648
Index: linux-2.6.16/drivers/i2c/chips/a780_camera.c
===================================================================
--- linux-2.6.16.orig/drivers/i2c/chips/a780_camera.c	2007-03-17 21:07:01.000000000 -0300
+++ linux-2.6.16/drivers/i2c/chips/a780_camera.c	2007-03-17 21:17:48.000000000 -0300
@@ -70,7 +70,12 @@
 static int i2c_camera_client_type = I2C_CLIENT_NONE;
 static unsigned long i2c_camera_chipid = 0;
 
-
+#ifdef CONFIG_I2C_OV9640
+extern int i2c_ov9640_init(void);
+extern int ov9640_read(u8 addr, u8 *pvalue);
+extern int ov9640_write(u8 addr, u8 value);
+extern int i2c_ov9640_cleanup(void);
+#endif
 static int a780_camera_adapter_attach(struct i2c_adapter *adap);
 static int a780_camera_detach(struct i2c_client *client);
 static int a780_camera_client_register(struct i2c_client *client);

