On Tue, 2008-06-03 at 14:31 -0700, Michael wrote:

> I would like to apologize first off for the slow response.  I somehow missed 
> this message in my inbox, and when I went back to check today, I found it.
> 
> When I run make, with this patch applied, I get the following error:
>   CC [M]  /home/michael/Programs/TVTuner/v4l-dvb-bef996fa0ded/v4l/cx18-gpio.o
> /home/michael/Programs/TVTuner/v4l-dvb-bef996fa0ded/v4l/cx18-gpio.c: In 
> function 'cx18_gpio_i2c_slave_reset':
> /home/michael/Programs/TVTuner/v4l-dvb-bef996fa0ded/v4l/cx18-gpio.c:73: 
> error: 'gpio_val' undeclared (first use in this function)
> /home/michael/Programs/TVTuner/v4l-dvb-bef996fa0ded/v4l/cx18-gpio.c:73: 
> error: (Each undeclared identifier is reported only once
> /home/michael/Programs/TVTuner/v4l-dvb-bef996fa0ded/v4l/cx18-gpio.c:73: 
> error: for each function it appears in.)

The cx18-gpio.c file has had a few fixes in it since I posted the patch.
Since you're using a very recent v4l-dvb tree, attached is a new version
of the patch.  (You'll need to back out the old version that's causing
compile errors.)

> make[3]: *** 
> [/home/michael/Programs/TVTuner/v4l-dvb-bef996fa0ded/v4l/cx18-gpio.o] Error 1
> make[2]: *** 
> [_module_/home/michael/Programs/TVTuner/v4l-dvb-bef996fa0ded/v4l] Error 2
> make[2]: Leaving directory `/usr/src/linux-2.6.22.17.tex2'
> make[1]: *** [default] Error 2
> make[1]: Leaving directory 
> `/home/michael/Programs/TVTuner/v4l-dvb-bef996fa0ded/v4l'
> make: *** [all] Error 2
> 
> It seems to compile fine without the patch.
> 
> I tried compiling this without the other two patches, if you want, I'll find 
> those patches, and try again.

No, not at this time.  Just this cx18-i2c-gpio-reset2.patch.

Let me know how it goes.

Regards,
Andy

> Thanks again for the help, and I apologize once again for the slow response.

diff -r 1e71c0c79b3a linux/drivers/media/video/cx18/cx18-cards.c
--- a/linux/drivers/media/video/cx18/cx18-cards.c	Tue Jun 03 19:12:00 2008 -0300
+++ b/linux/drivers/media/video/cx18/cx18-cards.c	Tue Jun 03 21:22:31 2008 -0400
@@ -81,6 +81,10 @@ static const struct cx18_card cx18_card_
 	},
 	.gpio_init.initial_value = 0x3001,
 	.gpio_init.direction = 0x3001,
+	.gpio_i2c_slave_reset.active_lo_mask = 0x3001,
+	.gpio_i2c_slave_reset.active_hi_mask = 0,
+	.gpio_i2c_slave_reset.msecs_asserted = 10,
+	.gpio_i2c_slave_reset.msecs_recovery = 40,
 	.i2c = &cx18_i2c_std,
 };
 
@@ -121,6 +125,10 @@ static const struct cx18_card cx18_card_
 	},
 	.gpio_init.initial_value = 0x3001,
 	.gpio_init.direction = 0x3001,
+	.gpio_i2c_slave_reset.active_lo_mask = 0x3001,
+	.gpio_i2c_slave_reset.active_hi_mask = 0,
+	.gpio_i2c_slave_reset.msecs_asserted = 10,
+	.gpio_i2c_slave_reset.msecs_recovery = 40,
 	.i2c = &cx18_i2c_std,
 };
 
diff -r 1e71c0c79b3a linux/drivers/media/video/cx18/cx18-cards.h
--- a/linux/drivers/media/video/cx18/cx18-cards.h	Tue Jun 03 19:12:00 2008 -0300
+++ b/linux/drivers/media/video/cx18/cx18-cards.h	Tue Jun 03 21:22:31 2008 -0400
@@ -118,6 +118,13 @@ struct cx18_gpio_init { /* set initial G
 	u32 initial_value;
 };
 
+struct cx18_gpio_i2c_slave_reset {
+	u32 active_lo_mask; /* GPIO outputs that reset i2c chips when low */
+	u32 active_hi_mask; /* GPIO outputs that reset i2c chips when high */
+	int msecs_asserted; /* time period reset must remain asserted */
+	int msecs_recovery; /* time after deassert for chips to be ready */
+};
+
 struct cx18_card_tuner {
 	v4l2_std_id std; 	/* standard for which the tuner is suitable */
 	int 	    tuner; 	/* tuner ID (from tuner.h) */
@@ -154,7 +161,8 @@ struct cx18_card {
 
 	/* GPIO card-specific settings */
 	u8 xceive_pin; 		/* XCeive tuner GPIO reset pin */
-	struct cx18_gpio_init 		gpio_init;
+	struct cx18_gpio_init 		 gpio_init;
+	struct cx18_gpio_i2c_slave_reset gpio_i2c_slave_reset;
 
 	struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];
 	struct cx18_card_tuner_i2c *i2c;
diff -r 1e71c0c79b3a linux/drivers/media/video/cx18/cx18-gpio.c
--- a/linux/drivers/media/video/cx18/cx18-gpio.c	Tue Jun 03 19:12:00 2008 -0300
+++ b/linux/drivers/media/video/cx18/cx18-gpio.c	Tue Jun 03 21:22:31 2008 -0400
@@ -57,6 +57,30 @@ static void gpio_write(struct cx18 *cx)
 			CX18_REG_GPIO_OUT2);
 }
 
+static void cx18_gpio_i2c_slave_reset(struct cx18 *cx)
+{
+	const struct cx18_gpio_i2c_slave_reset *p;
+
+	p = &cx->card->gpio_i2c_slave_reset;
+
+	if ((p->active_lo_mask | p->active_hi_mask) == 0)
+		return;
+
+	/* Assuming that the masks are a subset of the bits in gpio_dir */
+
+	/* Assert */
+	cx->gpio_val =
+		(cx->gpio_val | p->active_hi_mask) & ~(p->active_lo_mask);
+	gpio_write(cx);
+	schedule_timeout_interruptible(msecs_to_jiffies(p->msecs_asserted));
+
+	/* Deassert */
+	cx->gpio_val =
+		(cx->gpio_val | p->active_lo_mask) & ~(p->active_hi_mask);
+	gpio_write(cx);
+	schedule_timeout_interruptible(msecs_to_jiffies(p->msecs_recovery));
+}
+
 void cx18_gpio_init(struct cx18 *cx)
 {
 	cx->gpio_dir = cx->card->gpio_init.direction;
@@ -75,6 +99,8 @@ void cx18_gpio_init(struct cx18 *cx)
 		   read_reg(CX18_REG_GPIO_OUT1), read_reg(CX18_REG_GPIO_OUT2));
 
 	gpio_write(cx);
+
+	cx18_gpio_i2c_slave_reset(cx);
 }
 
 /* Xceive tuner reset function */
_______________________________________________
ivtv-users mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-users

Reply via email to