public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* em28xx: Compro VideoMate For You sound problems
@ 2009-02-24  7:47 Vitaly Wool
  2009-02-25  2:42 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 15+ messages in thread
From: Vitaly Wool @ 2009-02-24  7:47 UTC (permalink / raw)
  To: video4linux-list; +Cc: em28xx

Hello,

about half a year ago I posted the patch that basically enabled Compro 
VideoMate For You USB TV box support.
The main problem is I couldn't get the sound working. I was poking 
around that for some time then but gave up soon. Now I spent some time 
debugging the problem without any real success, tried the new 
(alternative) version of the em28xx driver suite from Markus and had no 
luck with it either.

So I kind of decomposed the box and found out the audio decoder chip 
used there was Philips TDA9874A. As far as I can see, it's not supported 
within the em28xx suite although it is for other TV tuner drivers. Could 
anyone please give me some guidance on how to add that to em28xx to 
shorten my way to getting the sound working on that good ol' box?

Thanks,
   Vitaly

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-24  7:47 em28xx: Compro VideoMate For You sound problems Vitaly Wool
@ 2009-02-25  2:42 ` Mauro Carvalho Chehab
  2009-02-25 12:42   ` Vitaly Wool
  0 siblings, 1 reply; 15+ messages in thread
From: Mauro Carvalho Chehab @ 2009-02-25  2:42 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: video4linux-list, em28xx

On Tue, 24 Feb 2009 10:47:43 +0300
Vitaly Wool <vital@embeddedalley.com> wrote:

> Hello,
> 
> about half a year ago I posted the patch that basically enabled Compro 
> VideoMate For You USB TV box support.
> The main problem is I couldn't get the sound working. I was poking 
> around that for some time then but gave up soon. Now I spent some time 
> debugging the problem without any real success, tried the new 
> (alternative) version of the em28xx driver suite from Markus and had no 
> luck with it either.
> 
> So I kind of decomposed the box and found out the audio decoder chip 
> used there was Philips TDA9874A. As far as I can see, it's not supported 
> within the em28xx suite although it is for other TV tuner drivers. Could 
> anyone please give me some guidance on how to add that to em28xx to 
> shorten my way to getting the sound working on that good ol' box?

Could you please try to load tvaudio module and see what happens? Please probe
it with debug info and post here the results.

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-25 12:42   ` Vitaly Wool
@ 2009-02-25 12:07     ` Mauro Carvalho Chehab
  2009-02-25 15:46       ` Vitaly Wool
  0 siblings, 1 reply; 15+ messages in thread
From: Mauro Carvalho Chehab @ 2009-02-25 12:07 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: video4linux-list, em28xx

On Wed, 25 Feb 2009 15:42:33 +0300
Vitaly Wool <vital@embeddedalley.com> wrote:

> Hello Mauro,
> 
> Mauro Carvalho Chehab wrote:
> 
> > On Tue, 24 Feb 2009 10:47:43 +0300
> > Vitaly Wool <vital@embeddedalley.com> wrote:
> >
> >> Hello,
> >>
> >> about half a year ago I posted the patch that basically enabled Compro 
> >> VideoMate For You USB TV box support.
> >> The main problem is I couldn't get the sound working. I was poking 
> >> around that for some time then but gave up soon. Now I spent some time 
> >> debugging the problem without any real success, tried the new 
> >> (alternative) version of the em28xx driver suite from Markus and had no 
> >> luck with it either.
> >>
> >> So I kind of decomposed the box and found out the audio decoder chip 
> >> used there was Philips TDA9874A. As far as I can see, it's not supported 
> >> within the em28xx suite although it is for other TV tuner drivers. Could 
> >> anyone please give me some guidance on how to add that to em28xx to 
> >> shorten my way to getting the sound working on that good ol' box?
> >
> > Could you please try to load tvaudio module and see what happens? Please probe
> > it with debug info and post here the results.
> here it is:
> 
> [78735.039693] tvaudio: TV audio decoder + audio/video mux driver
> 
> [78735.039693] tvaudio: known chips: tda9840, tda9873h, tda9874h/a, tda9850, tda9855, tea6300, tea6320, tea6420, tda8425, pic16c54 (PV951), ta8874z
> 
> [78735.039693] tvaudio' 1-0058: chip found @ 0xb0
> 
> [78735.049368] tvaudio' 1-0058: tvaudio': chip_read2: reg254=0x11
> 
> [78735.068049] tvaudio' 1-0058: tvaudio': chip_read2: reg255=0x2
> 
> [78735.068056] tvaudio' 1-0058: tda9874a_checkit(): DIC=0x11, SIC=0x2.
> 
> [78735.068059] tvaudio' 1-0058: found tda9874a.
> 
> [78735.068063] tvaudio' 1-0058: tda9874h/a found @ 0xb0 (em28xx #0)
> 
> [78735.068066] tvaudio' 1-0058: tda9874h/a: chip_write: reg0=0x0
> 
> [78735.079304] tvaudio' 1-0058: tda9874h/a: chip_write: reg1=0xc0
> 
> [78735.091299] tvaudio' 1-0058: tda9874h/a: chip_write: reg2=0x2
> 
> [78735.103300] tvaudio' 1-0058: tda9874h/a: chip_write: reg11=0x80
> 
> [78735.115291] tvaudio' 1-0058: tda9874h/a: chip_write: reg12=0x0
> 
> [78735.126706] tvaudio' 1-0058: tda9874h/a: chip_write: reg13=0x0
> 
> [78735.138668] tvaudio' 1-0058: tda9874h/a: chip_write: reg14=0x1
> 
> [78735.150665] tvaudio' 1-0058: tda9874h/a: chip_write: reg15=0x0
> 
> [78735.162661] tvaudio' 1-0058: tda9874h/a: chip_write: reg16=0x14
> 
> [78735.174656] tvaudio' 1-0058: tda9874h/a: chip_write: reg17=0x50
> 
> [78735.186651] tvaudio' 1-0058: tda9874h/a: chip_write: reg18=0xf9
> 
> [78735.198648] tvaudio' 1-0058: tda9874h/a: chip_write: reg19=0x80
> 
> [78735.208703] tvaudio' 1-0058: tda9874h/a: chip_write: reg20=0x80
> 
> [78735.220988] tvaudio' 1-0058: tda9874h/a: chip_write: reg24=0x80
> 
> [78735.232982] tvaudio' 1-0058: tda9874h/a: chip_write: reg255=0x0
> 
> [78735.244979] tvaudio' 1-0058: tda9874a_setup(): A2, B/G [0x00].
> 
> [78735.246530] tvaudio' 1-0058: tda9874h/a: thread started]

Ok, so if everything else is properly configured on em28xx, you should have
audio working. 

I've just committed a patch that should automatically load tvaudio for your
board. Could you please test it?

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-25  2:42 ` Mauro Carvalho Chehab
@ 2009-02-25 12:42   ` Vitaly Wool
  2009-02-25 12:07     ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 15+ messages in thread
From: Vitaly Wool @ 2009-02-25 12:42 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: video4linux-list, em28xx

Hello Mauro,

Mauro Carvalho Chehab wrote:

> On Tue, 24 Feb 2009 10:47:43 +0300
> Vitaly Wool <vital@embeddedalley.com> wrote:
>
>> Hello,
>>
>> about half a year ago I posted the patch that basically enabled Compro 
>> VideoMate For You USB TV box support.
>> The main problem is I couldn't get the sound working. I was poking 
>> around that for some time then but gave up soon. Now I spent some time 
>> debugging the problem without any real success, tried the new 
>> (alternative) version of the em28xx driver suite from Markus and had no 
>> luck with it either.
>>
>> So I kind of decomposed the box and found out the audio decoder chip 
>> used there was Philips TDA9874A. As far as I can see, it's not supported 
>> within the em28xx suite although it is for other TV tuner drivers. Could 
>> anyone please give me some guidance on how to add that to em28xx to 
>> shorten my way to getting the sound working on that good ol' box?
>
> Could you please try to load tvaudio module and see what happens? Please probe
> it with debug info and post here the results.
here it is:

[78735.039693] tvaudio: TV audio decoder + audio/video mux driver

[78735.039693] tvaudio: known chips: tda9840, tda9873h, tda9874h/a, tda9850, tda9855, tea6300, tea6320, tea6420, tda8425, pic16c54 (PV951), ta8874z

[78735.039693] tvaudio' 1-0058: chip found @ 0xb0

[78735.049368] tvaudio' 1-0058: tvaudio': chip_read2: reg254=0x11

[78735.068049] tvaudio' 1-0058: tvaudio': chip_read2: reg255=0x2

[78735.068056] tvaudio' 1-0058: tda9874a_checkit(): DIC=0x11, SIC=0x2.

[78735.068059] tvaudio' 1-0058: found tda9874a.

[78735.068063] tvaudio' 1-0058: tda9874h/a found @ 0xb0 (em28xx #0)

[78735.068066] tvaudio' 1-0058: tda9874h/a: chip_write: reg0=0x0

[78735.079304] tvaudio' 1-0058: tda9874h/a: chip_write: reg1=0xc0

[78735.091299] tvaudio' 1-0058: tda9874h/a: chip_write: reg2=0x2

[78735.103300] tvaudio' 1-0058: tda9874h/a: chip_write: reg11=0x80

[78735.115291] tvaudio' 1-0058: tda9874h/a: chip_write: reg12=0x0

[78735.126706] tvaudio' 1-0058: tda9874h/a: chip_write: reg13=0x0

[78735.138668] tvaudio' 1-0058: tda9874h/a: chip_write: reg14=0x1

[78735.150665] tvaudio' 1-0058: tda9874h/a: chip_write: reg15=0x0

[78735.162661] tvaudio' 1-0058: tda9874h/a: chip_write: reg16=0x14

[78735.174656] tvaudio' 1-0058: tda9874h/a: chip_write: reg17=0x50

[78735.186651] tvaudio' 1-0058: tda9874h/a: chip_write: reg18=0xf9

[78735.198648] tvaudio' 1-0058: tda9874h/a: chip_write: reg19=0x80

[78735.208703] tvaudio' 1-0058: tda9874h/a: chip_write: reg20=0x80

[78735.220988] tvaudio' 1-0058: tda9874h/a: chip_write: reg24=0x80

[78735.232982] tvaudio' 1-0058: tda9874h/a: chip_write: reg255=0x0

[78735.244979] tvaudio' 1-0058: tda9874a_setup(): A2, B/G [0x00].

[78735.246530] tvaudio' 1-0058: tda9874h/a: thread started

Thanks,
   Vitaly


--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-25 15:46       ` Vitaly Wool
@ 2009-02-25 13:18         ` Mauro Carvalho Chehab
  2009-02-25 16:58           ` Vitaly Wool
  2009-02-25 17:11           ` Vitaly Wool
  0 siblings, 2 replies; 15+ messages in thread
From: Mauro Carvalho Chehab @ 2009-02-25 13:18 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: video4linux-list, em28xx

On Wed, 25 Feb 2009 18:46:33 +0300
Vitaly Wool <vital@embeddedalley.com> wrote:

> Mauro,
> 
> Mauro Carvalho Chehab wrote:
> 
> > Ok, so if everything else is properly configured on em28xx, you should have
> > audio working. 
> >
> > I've just committed a patch that should automatically load tvaudio for your
> > board. Could you please test it?
> it looks like I've got the sound coming out of the board with the following piece of hackery:
> 
> diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
> index eee8d01..55bcf42 100644
> --- a/drivers/media/video/em28xx/em28xx-core.c
> +++ b/drivers/media/video/em28xx/em28xx-core.c
> @@ -406,6 +406,24 @@ int em28xx_audio_analog_set(struct em28xx *dev)
>  	int ret, i;
>  	u8 xclk;
>  
> +	if (dev->i2c_tvaudio_client) {
> +		char c;
> +		switch (dev->ctl_ainput) {
> +		case 0:
> +			c = 0xfd;
> +			break;
> +		case 1:
> +			c = 0xfc;
> +			break;
> +		default:
> +			c = 0xfe;
> +			break;
> +		}
> +		if (dev->mute)
> +			c = 0xfe;
> +		return em28xx_write_regs(dev, 0x08, &c, 1);
> +	}

Ah, so, it needs gpio setups per input. This is supported by the driver. You
just need to add a .gpio entry just like what he have for
EM2882_BOARD_TERRATEC_HYBRID_XS.

> diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
> index 2dab43d..55e5a2e 100644
> --- a/drivers/media/video/em28xx/em28xx-i2c.c
> +++ b/drivers/media/video/em28xx/em28xx-i2c.c
> @@ -510,12 +510,21 @@ static int attach_inform(struct i2c_client *client)
>  		dprintk1(1, "attach_inform: tvp5150 detected.\n");
>  		break;
>  
> +	case 0xb0:
> +		dprintk1(1, "attach_inform: tda9874 detected\n");
> +		dprintk1(1, "driver id %d\n", client->driver->id);
> +		dev->i2c_tvaudio_client = client;
> +		if (!dev->tuner_addr)
> +			dev->tuner_addr = client->addr;
> +		break;
> +

The above is not needed, and it is wrong to touch at tuner_addr. It would ok to
just add a printk there to inform that tvaudio were connected.

> @@ -554,6 +563,7 @@ static char *i2c_devs[128] = {
>  	[0x80 >> 1] = "msp34xx",
>  	[0x88 >> 1] = "msp34xx",
>  	[0xa0 >> 1] = "eeprom",
> +	[0xb0 >> 1] = "tvaudio",
>  	[0xb8 >> 1] = "tvp5150a",
>  	[0xba >> 1] = "tvp5150a",
>  	[0xc0 >> 1] = "tuner (analog)",

instead of tvaudio, please use tda9874. there are other audio devices on 0xb0 address.

> diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
> index efd6415..5f7f4da 100644
> --- a/drivers/media/video/em28xx/em28xx-video.c
> +++ b/drivers/media/video/em28xx/em28xx-video.c
> @@ -540,6 +540,13 @@ static void video_mux(struct em28xx *dev, int index)
>  			&route);
>  	}
>  
> +	if (dev->i2c_tvaudio_client) {
> +		route.input = dev->ctl_ainput;
> +		route.output = 0;
> +		em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING,
> +			&route);
> +	}
> +
>  	em28xx_audio_analog_set(dev);
>  }

Ok, this is needed. After my patch, the test should be:
	if (dev->board.adecoder != EM28XX_NOADECODER)

This will be generic enough to work with other devices with audio decoders. We
are currently working with another em28xx that has a yet unsupported audio
chip. I suspect that the list of audio chips will need to be increased. So, it
is better to have a more generic support to allow loading other audio decoders.

> diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
> index 100f90a..c263f5d 100644
> --- a/drivers/media/video/em28xx/em28xx-cards.c
> +++ b/drivers/media/video/em28xx/em28xx-cards.c
> @@ -1248,7 +1248,7 @@ struct em28xx_board em28xx_boards[] = {
>  		.input        = { {
>  			.type     = EM28XX_VMUX_TELEVISION,
>  			.vmux     = TVP5150_COMPOSITE0,
> -			.amux     = EM28XX_AMUX_LINE_IN,
> +			.amux     = EM28XX_AMUX_VIDEO,
>  		}, {
>  			.type     = EM28XX_VMUX_SVIDEO,
>  			.vmux     = TVP5150_SVIDEO,

The actual value for amux will depend on your mixer chip, if there is any.
Could you provide your full em28xx log? Let's see if it will detect EM202 or
another AC97 chip.

> Please note the .amux change; my bad it wasn't right from the bery beginning. However, just changing it
> doesn't make things work, either with your latest patch or without it. Changes in em28xx_audio_analog_set are 
> apparently what matter. but I'm not sure.
> 
> The other thing is that even with this patch, I'm getting more noise than TV sound. That might be related to
> some TDA9874 programming needed and not done, but I'm not sure here either.

It may be due to that wrong change on em28xx-i2c.

IMO, it would be better if you could do a patch with the remaining changes. 

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-25 12:07     ` Mauro Carvalho Chehab
@ 2009-02-25 15:46       ` Vitaly Wool
  2009-02-25 13:18         ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 15+ messages in thread
From: Vitaly Wool @ 2009-02-25 15:46 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: video4linux-list, em28xx

Mauro,

Mauro Carvalho Chehab wrote:

> Ok, so if everything else is properly configured on em28xx, you should have
> audio working. 
>
> I've just committed a patch that should automatically load tvaudio for your
> board. Could you please test it?
it looks like I've got the sound coming out of the board with the following piece of hackery:

diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index eee8d01..55bcf42 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -406,6 +406,24 @@ int em28xx_audio_analog_set(struct em28xx *dev)
 	int ret, i;
 	u8 xclk;
 
+	if (dev->i2c_tvaudio_client) {
+		char c;
+		switch (dev->ctl_ainput) {
+		case 0:
+			c = 0xfd;
+			break;
+		case 1:
+			c = 0xfc;
+			break;
+		default:
+			c = 0xfe;
+			break;
+		}
+		if (dev->mute)
+			c = 0xfe;
+		return em28xx_write_regs(dev, 0x08, &c, 1);
+	}
+
 	if (!dev->audio_mode.has_audio)
 		return 0;
 
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 2dab43d..55e5a2e 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -510,12 +510,21 @@ static int attach_inform(struct i2c_client *client)
 		dprintk1(1, "attach_inform: tvp5150 detected.\n");
 		break;
 
+	case 0xb0:
+		dprintk1(1, "attach_inform: tda9874 detected\n");
+		dprintk1(1, "driver id %d\n", client->driver->id);
+		dev->i2c_tvaudio_client = client;
+		if (!dev->tuner_addr)
+			dev->tuner_addr = client->addr;
+		break;
+
 	default:
 		if (!dev->tuner_addr)
 			dev->tuner_addr = client->addr;
 
 		dprintk1(1, "attach inform: detected I2C address %x\n",
 				client->addr << 1);
+		dprintk1(1, "driver id %d\n", client->driver->id);
 
 	}
 
@@ -554,6 +563,7 @@ static char *i2c_devs[128] = {
 	[0x80 >> 1] = "msp34xx",
 	[0x88 >> 1] = "msp34xx",
 	[0xa0 >> 1] = "eeprom",
+	[0xb0 >> 1] = "tvaudio",
 	[0xb8 >> 1] = "tvp5150a",
 	[0xba >> 1] = "tvp5150a",
 	[0xc0 >> 1] = "tuner (analog)",
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index efd6415..5f7f4da 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -540,6 +540,13 @@ static void video_mux(struct em28xx *dev, int index)
 			&route);
 	}
 
+	if (dev->i2c_tvaudio_client) {
+		route.input = dev->ctl_ainput;
+		route.output = 0;
+		em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING,
+			&route);
+	}
+
 	em28xx_audio_analog_set(dev);
 }
 
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 3e82d81..67c00af 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -479,6 +479,7 @@ struct em28xx {
 	/* i2c i/o */
 	struct i2c_adapter i2c_adap;
 	struct i2c_client i2c_client;
+	struct i2c_client *i2c_tvaudio_client;
 	/* video for linux */
 	int users;		/* user count for exclusive use */
 	struct video_device *vdev;	/* video for linux device struct */
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 100f90a..c263f5d 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -1248,7 +1248,7 @@ struct em28xx_board em28xx_boards[] = {
 		.input        = { {
 			.type     = EM28XX_VMUX_TELEVISION,
 			.vmux     = TVP5150_COMPOSITE0,
-			.amux     = EM28XX_AMUX_LINE_IN,
+			.amux     = EM28XX_AMUX_VIDEO,
 		}, {
 			.type     = EM28XX_VMUX_SVIDEO,
 			.vmux     = TVP5150_SVIDEO,



Please note the .amux change; my bad it wasn't right from the bery beginning. However, just changing it
doesn't make things work, either with your latest patch or without it. Changes in em28xx_audio_analog_set are 
apparently what matter. but I'm not sure.

The other thing is that even with this patch, I'm getting more noise than TV sound. That might be related to
some TDA9874 programming needed and not done, but I'm not sure here either.

Thanks,
   Vitaly

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-25 13:18         ` Mauro Carvalho Chehab
@ 2009-02-25 16:58           ` Vitaly Wool
  2009-02-25 17:11           ` Vitaly Wool
  1 sibling, 0 replies; 15+ messages in thread
From: Vitaly Wool @ 2009-02-25 16:58 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: video4linux-list, em28xx

Mauro Carvalho Chehab wrote:
> The actual value for amux will depend on your mixer chip, if there is any.
> Could you provide your full em28xx log? Let's see if it will detect EM202 or
> another AC97 chip.
>
>   

Well that's what it says:
[12749.748715] em28xx #0: No AC97 audio processor

Thanks,
   Vitaly

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-25 13:18         ` Mauro Carvalho Chehab
  2009-02-25 16:58           ` Vitaly Wool
@ 2009-02-25 17:11           ` Vitaly Wool
  2009-02-25 18:33             ` Mauro Carvalho Chehab
  1 sibling, 1 reply; 15+ messages in thread
From: Vitaly Wool @ 2009-02-25 17:11 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: video4linux-list, em28xx

Mauro Carvalho Chehab wrote:

>
> IMO, it would be better if you could do a patch with the remaining changes. 
after doing the mods you'd suggested I found out that the noise started coming out after the em28xx module loading
stops when em28xx_set_audio_source() is executed. Don't I need to add some tweaks there as well?

The patch is now looking the following way:

diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 100f90a..f300e74 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -1245,14 +1245,17 @@ struct em28xx_board em28xx_boards[] = {
 		.tda9887_conf = TDA9887_PRESENT,
 		.decoder      = EM28XX_TVP5150,
 		.adecoder     = EM28XX_TVAUDIO,
+		.tuner_gpio   = default_tuner_gpio,
 		.input        = { {
 			.type     = EM28XX_VMUX_TELEVISION,
 			.vmux     = TVP5150_COMPOSITE0,
-			.amux     = EM28XX_AMUX_LINE_IN,
+			.amux     = EM28XX_AMUX_VIDEO,
+			.gpio     = default_analog,
 		}, {
 			.type     = EM28XX_VMUX_SVIDEO,
 			.vmux     = TVP5150_SVIDEO,
 			.amux     = EM28XX_AMUX_LINE_IN,
+			.gpio     = default_analog,
 		} },
 	},
 	[EM2860_BOARD_KAIOMY_TVNPC_U2] = {
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index eee8d01..b5b2396 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -354,6 +354,7 @@ static int em28xx_set_audio_source(struct em28xx *dev)
 	int ret;
 	u8 input;
 
+	printk("%s: entered\n", __func__);
 	if (dev->board.is_em2800) {
 		if (dev->ctl_ainput == EM28XX_AMUX_VIDEO)
 			input = EM2800_AUDIO_SRC_TUNER;
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 2dab43d..02c12fe 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -510,12 +510,17 @@ static int attach_inform(struct i2c_client *client)
 		dprintk1(1, "attach_inform: tvp5150 detected.\n");
 		break;
 
+	case 0xb0:
+		dprintk1(1, "attach_inform: tda9874 detected\n");
+		break;
+
 	default:
 		if (!dev->tuner_addr)
 			dev->tuner_addr = client->addr;
 
 		dprintk1(1, "attach inform: detected I2C address %x\n",
 				client->addr << 1);
+		dprintk1(1, "driver id %d\n", client->driver->id);
 
 	}
 
@@ -554,6 +559,7 @@ static char *i2c_devs[128] = {
 	[0x80 >> 1] = "msp34xx",
 	[0x88 >> 1] = "msp34xx",
 	[0xa0 >> 1] = "eeprom",
+	[0xb0 >> 1] = "tda9874",
 	[0xb8 >> 1] = "tvp5150a",
 	[0xba >> 1] = "tvp5150a",
 	[0xc0 >> 1] = "tuner (analog)",
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index efd6415..3ce8e95 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -540,6 +540,13 @@ static void video_mux(struct em28xx *dev, int index)
 			&route);
 	}
 
+	if (dev->board.adecoder != EM28XX_NOADECODER) {
+		route.input = dev->ctl_ainput;
+		route.output = 0;
+		em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING,
+			&route);
+	}
+
 	em28xx_audio_analog_set(dev);
 }
 
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h


Thanks,
   Vitaly

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-25 17:11           ` Vitaly Wool
@ 2009-02-25 18:33             ` Mauro Carvalho Chehab
  2009-02-25 19:25               ` Vitaly Wool
  0 siblings, 1 reply; 15+ messages in thread
From: Mauro Carvalho Chehab @ 2009-02-25 18:33 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: video4linux-list, em28xx

On Wed, 25 Feb 2009 20:11:48 +0300
Vitaly Wool <vital@embeddedalley.com> wrote:

> Mauro Carvalho Chehab wrote:
> 
> >
> > IMO, it would be better if you could do a patch with the remaining changes. 
> after doing the mods you'd suggested I found out that the noise started coming out after the em28xx module loading
> stops when em28xx_set_audio_source() is executed. Don't I need to add some tweaks there as well?

See bellow.
> 
> The patch is now looking the following way:

It seems that we are close to have a patch for it ;) I have just a few comments/suggestions.

> 
> diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
> index 100f90a..f300e74 100644
> --- a/drivers/media/video/em28xx/em28xx-cards.c
> +++ b/drivers/media/video/em28xx/em28xx-cards.c
> @@ -1245,14 +1245,17 @@ struct em28xx_board em28xx_boards[] = {
>  		.tda9887_conf = TDA9887_PRESENT,
>  		.decoder      = EM28XX_TVP5150,
>  		.adecoder     = EM28XX_TVAUDIO,
> +		.tuner_gpio   = default_tuner_gpio,

You don't need a tuner gpio. This is used basically by xc3028 based devices, in
order to reset it during software upload.

Instead, we should add another gpio here, for mute. This should be called in a
place where we can remove the unwanted noise (e. g. at the beginning of the
device setup logic), and when mute is selected by the audio functions.

>  		.input        = { {
>  			.type     = EM28XX_VMUX_TELEVISION,
>  			.vmux     = TVP5150_COMPOSITE0,
> -			.amux     = EM28XX_AMUX_LINE_IN,
> +			.amux     = EM28XX_AMUX_VIDEO,
> +			.gpio     = default_analog,
>  		}, {
>  			.type     = EM28XX_VMUX_SVIDEO,
>  			.vmux     = TVP5150_SVIDEO,
>  			.amux     = EM28XX_AMUX_LINE_IN,
> +			.gpio     = default_analog,
>  		} },
>  	},

On your first patches, you were using different values for .gpio (0xfd?). You
should use the value you found on your windows driver, since enabling more
gpio's than needed could generate some troubles on certain devices.

>  	[EM2860_BOARD_KAIOMY_TVNPC_U2] = {
> diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
> index eee8d01..b5b2396 100644
> --- a/drivers/media/video/em28xx/em28xx-core.c
> +++ b/drivers/media/video/em28xx/em28xx-core.c
> @@ -354,6 +354,7 @@ static int em28xx_set_audio_source(struct em28xx *dev)
>  	int ret;
>  	u8 input;
>  
> +	printk("%s: entered\n", __func__);

(I'm assuming that you'll either convert it into a dprintk or remove the above line on the final patch)

>  	default:
>  		if (!dev->tuner_addr)
>  			dev->tuner_addr = client->addr;
>  
>  		dprintk1(1, "attach inform: detected I2C address %x\n",
>  				client->addr << 1);
> +		dprintk1(1, "driver id %d\n", client->driver->id);

I liked this. However, this will likely be removed soon, since the i2c
maintainer intends to remove the driver->id. Well, for now, let's keep it.



Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-25 18:33             ` Mauro Carvalho Chehab
@ 2009-02-25 19:25               ` Vitaly Wool
  2009-02-25 23:40                 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 15+ messages in thread
From: Vitaly Wool @ 2009-02-25 19:25 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: video4linux-list, em28xx

Mauro,

Mauro Carvalho Chehab wrote:
>   
>> diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
>> index 100f90a..f300e74 100644
>> --- a/drivers/media/video/em28xx/em28xx-cards.c
>> +++ b/drivers/media/video/em28xx/em28xx-cards.c
>> @@ -1245,14 +1245,17 @@ struct em28xx_board em28xx_boards[] = {
>>  		.tda9887_conf = TDA9887_PRESENT,
>>  		.decoder      = EM28XX_TVP5150,
>>  		.adecoder     = EM28XX_TVAUDIO,
>> +		.tuner_gpio   = default_tuner_gpio,
>>     
>
> You don't need a tuner gpio. This is used basically by xc3028 based devices, in
> order to reset it during software upload.
>
> Instead, we should add another gpio here, for mute. This should be called in a
> place where we can remove the unwanted noise (e. g. at the beginning of the
> device setup logic), and when mute is selected by the audio functions.
>   
I'm not quite sure I understood. Do I need to add another field to the 
board structure and use it where appropriate?

Thanks,
   Vitaly

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-25 19:25               ` Vitaly Wool
@ 2009-02-25 23:40                 ` Mauro Carvalho Chehab
  2009-02-27 15:12                   ` Vitaly Wool
  0 siblings, 1 reply; 15+ messages in thread
From: Mauro Carvalho Chehab @ 2009-02-25 23:40 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: video4linux-list, em28xx

On Wed, 25 Feb 2009 22:25:37 +0300
Vitaly Wool <vital@embeddedalley.com> wrote:

> Mauro,
> 
> Mauro Carvalho Chehab wrote:
> >   
> >> diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
> >> index 100f90a..f300e74 100644
> >> --- a/drivers/media/video/em28xx/em28xx-cards.c
> >> +++ b/drivers/media/video/em28xx/em28xx-cards.c
> >> @@ -1245,14 +1245,17 @@ struct em28xx_board em28xx_boards[] = {
> >>  		.tda9887_conf = TDA9887_PRESENT,
> >>  		.decoder      = EM28XX_TVP5150,
> >>  		.adecoder     = EM28XX_TVAUDIO,
> >> +		.tuner_gpio   = default_tuner_gpio,
> >>     
> >
> > You don't need a tuner gpio. This is used basically by xc3028 based devices, in
> > order to reset it during software upload.
> >
> > Instead, we should add another gpio here, for mute. This should be called in a
> > place where we can remove the unwanted noise (e. g. at the beginning of the
> > device setup logic), and when mute is selected by the audio functions.
> >   
> I'm not quite sure I understood. Do I need to add another field to the 
> board structure and use it where appropriate?

Yes, that's what I'm meaning.

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-25 23:40                 ` Mauro Carvalho Chehab
@ 2009-02-27 15:12                   ` Vitaly Wool
  2009-02-27 15:43                     ` Vitaly Wool
  0 siblings, 1 reply; 15+ messages in thread
From: Vitaly Wool @ 2009-02-27 15:12 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: video4linux-list, em28xx

Hi Mauro,

Mauro Carvalho Chehab wrote:
> On Wed, 25 Feb 2009 22:25:37 +0300
> Vitaly Wool <vital@embeddedalley.com> wrote: 
>   
>> I'm not quite sure I understood. Do I need to add another field to the 
>> board structure and use it where appropriate?
>>     
>
> Yes, that's what I'm meaning.
>   
Ok, I'm working on that. The problem as of now is that it works fine on 
2.6.26 and doesn't work with 2.6.29-rc5.
I'll get back to you when I find out the reason.

Thanks,
   Vitaly

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-27 15:12                   ` Vitaly Wool
@ 2009-02-27 15:43                     ` Vitaly Wool
  2009-02-28  0:40                       ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 15+ messages in thread
From: Vitaly Wool @ 2009-02-27 15:43 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: video4linux-list, Mauro Carvalho Chehab

Vitaly Wool wrote:

> Ok, I'm working on that. The problem as of now is that it works fine on 
> 2.6.26 and doesn't work with 2.6.29-rc5.
> I'll get back to you when I find out the reason.
And here's the patch that solves the problem:

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 5aeccb3..ae4b231 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -169,12 +169,14 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val)
 			return -1;
 		}
 	} else {
+#if 0
 		if (subaddr + 1 >= ARRAY_SIZE(chip->shadow.bytes)) {
 			v4l2_info(sd,
 				"Tried to access a non-existent register: %d\n",
 				subaddr);
 			return -EINVAL;
 		}
+#endif
 
 		v4l2_dbg(1, debug, sd, "chip_write: reg%d=0x%x\n",
 			subaddr, val);



Apparently this check is bogus. The patch for em28xx stuff will follow, after some cleanups.

Thanks,
   Vitaly

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-27 15:43                     ` Vitaly Wool
@ 2009-02-28  0:40                       ` Mauro Carvalho Chehab
  2009-02-28  4:49                         ` Vitaly Wool
  0 siblings, 1 reply; 15+ messages in thread
From: Mauro Carvalho Chehab @ 2009-02-28  0:40 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: video4linux-list

On Fri, 27 Feb 2009 18:43:07 +0300
Vitaly Wool <vital@embeddedalley.com> wrote:

> Vitaly Wool wrote:
> 
> > Ok, I'm working on that. The problem as of now is that it works fine on 
> > 2.6.26 and doesn't work with 2.6.29-rc5.
> > I'll get back to you when I find out the reason.
> And here's the patch that solves the problem:
> 
> diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
> index 5aeccb3..ae4b231 100644
> --- a/drivers/media/video/tvaudio.c
> +++ b/drivers/media/video/tvaudio.c
> @@ -169,12 +169,14 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val)
>  			return -1;
>  		}
>  	} else {
> +#if 0
>  		if (subaddr + 1 >= ARRAY_SIZE(chip->shadow.bytes)) {
>  			v4l2_info(sd,
>  				"Tried to access a non-existent register: %d\n",
>  				subaddr);
>  			return -EINVAL;
>  		}
> +#endif
>  
>  		v4l2_dbg(1, debug, sd, "chip_write: reg%d=0x%x\n",
>  			subaddr, val);
> 
> 
> 
> Apparently this check is bogus. The patch for em28xx stuff will follow, after some cleanups.

Hmm... the check is to avoid accessing an out of range registrer cache. Could you
please send me the errors generated by the v4l2_info msg?
> 
> Thanks,
>    Vitaly
> 




Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: em28xx: Compro VideoMate For You sound problems
  2009-02-28  0:40                       ` Mauro Carvalho Chehab
@ 2009-02-28  4:49                         ` Vitaly Wool
  0 siblings, 0 replies; 15+ messages in thread
From: Vitaly Wool @ 2009-02-28  4:49 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: video4linux-list

Mauro Carvalho Chehab wrote:
> On Fri, 27 Feb 2009 18:43:07 +0300
> Vitaly Wool <vital@embeddedalley.com> wrote:
>
>   
>> Vitaly Wool wrote:
>>
>>     
>>> Ok, I'm working on that. The problem as of now is that it works fine on 
>>> 2.6.26 and doesn't work with 2.6.29-rc5.
>>> I'll get back to you when I find out the reason.
>>>       
>> And here's the patch that solves the problem:
>>
>> diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
>> index 5aeccb3..ae4b231 100644
>> --- a/drivers/media/video/tvaudio.c
>> +++ b/drivers/media/video/tvaudio.c
>> @@ -169,12 +169,14 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val)
>>  			return -1;
>>  		}
>>  	} else {
>> +#if 0
>>  		if (subaddr + 1 >= ARRAY_SIZE(chip->shadow.bytes)) {
>>  			v4l2_info(sd,
>>  				"Tried to access a non-existent register: %d\n",
>>  				subaddr);
>>  			return -EINVAL;
>>  		}
>> +#endif
>>  
>>  		v4l2_dbg(1, debug, sd, "chip_write: reg%d=0x%x\n",
>>  			subaddr, val);
>>
>>
>>
>> Apparently this check is bogus. The patch for em28xx stuff will follow, after some cleanups.
>>     
>
> Hmm... the check is to avoid accessing an out of range registrer cache. Could you
> please send me the errors generated by the v4l2_info msg?
>   
The ARRAY_SIZE actually is 65 in this situation. I've no idea yet where 
that is derived from.
The "false erroneous" access is to register 255, for quick configuration:

#define TDA9874A_ESP            0xFF    /* easy standard progr. 
(tda9874a) */

So either the bytes array is set up incorrectly, or the check is bogus, 
IMHO.

Thanks,
   Vitaly

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-02-28  4:50 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-24  7:47 em28xx: Compro VideoMate For You sound problems Vitaly Wool
2009-02-25  2:42 ` Mauro Carvalho Chehab
2009-02-25 12:42   ` Vitaly Wool
2009-02-25 12:07     ` Mauro Carvalho Chehab
2009-02-25 15:46       ` Vitaly Wool
2009-02-25 13:18         ` Mauro Carvalho Chehab
2009-02-25 16:58           ` Vitaly Wool
2009-02-25 17:11           ` Vitaly Wool
2009-02-25 18:33             ` Mauro Carvalho Chehab
2009-02-25 19:25               ` Vitaly Wool
2009-02-25 23:40                 ` Mauro Carvalho Chehab
2009-02-27 15:12                   ` Vitaly Wool
2009-02-27 15:43                     ` Vitaly Wool
2009-02-28  0:40                       ` Mauro Carvalho Chehab
2009-02-28  4:49                         ` Vitaly Wool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox