Skip to contentSkip to conversation

em28xx: enable Compro VideoMate ForYou sound

PATCH In review Vitaly Wool 2 participants 5 messages Mar 2, 2009 – Mar 3, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 em28xx: enable Compro VideoMate ForYou sound

Hello Mauro,

below is the final patch candidate for Compro VideoMate ForYou/Stereo USB TV box sound enablement.

The tvaudio changes are put aside, as it is a separate matter.

Thanks,
Vitaly

drivers/media/video/em28xx/em28xx-cards.c |   17 ++++++++++++++++-
drivers/media/video/em28xx/em28xx-core.c  |   11 +++++++++++
drivers/media/video/em28xx/em28xx-i2c.c   |    6 ++++++
drivers/media/video/em28xx/em28xx-video.c |    7 +++++++
drivers/media/video/em28xx/em28xx.h       |    2 ++
5 files changed, 42 insertions(+), 1 deletion(-)
drivers/media/video/em28xx/em28xx-cards.c +0 -0
Index: linux-next/drivers/media/video/em28xx/em28xx-cards.c
===================================================================
@@ -122,6 +122,17 @@
	{  -1,			-1,		-1,		-1},
};

+/* Mute/unmute */
+static struct em28xx_reg_seq compro_unmute_gpio[] = {
+ {EM28XX_R08_GPIO, EM_GPIO_0, EM_GPIO_0 | EM_GPIO_1, 10},
+ { -1, -1, -1, -1},
+};
+
+static struct em28xx_reg_seq compro_mute_gpio[] = {
+ {EM28XX_R08_GPIO, EM_GPIO_1, EM_GPIO_0 | EM_GPIO_1, 10},
+ { -1, -1, -1, -1},
+};
+
/*
* Board definitions
*/
@@ -1225,14 +1236,18 @@

		.tda9887_conf = TDA9887_PRESENT,
		.decoder      = EM28XX_TVP5150,
		.adecoder     = EM28XX_TVAUDIO,
+		.mute_gpio    = compro_mute_gpio,
+		.unmute_gpio  = compro_unmute_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] = {
drivers/media/video/em28xx/em28xx-core.c +0 -0
Index: linux-next/drivers/media/video/em28xx/em28xx-core.c
===================================================================
@@ -353,6 +353,7 @@
{
	int ret;
	u8 input;

+ int do_mute = 0;

	if (dev->board.is_em2800) {
		if (dev->ctl_ainput == EM28XX_AMUX_VIDEO)
@@ -378,6 +379,16 @@
		}
	}

+ if (dev->mute || input != EM28XX_AUDIO_SRC_TUNER)
+ do_mute = 1;
+
+ if (dev->board.mute_gpio && do_mute)
+ em28xx_gpio_set(dev, dev->board.mute_gpio);
+
+ if (dev->board.unmute_gpio && !do_mute)
+ em28xx_gpio_set(dev, dev->board.unmute_gpio);
+
+

	ret = em28xx_write_reg_bits(dev, EM28XX_R0E_AUDIOSRC, input, 0xc0);
	if (ret < 0)
		return ret;
drivers/media/video/em28xx/em28xx-i2c.c +0 -0
Index: linux-next/drivers/media/video/em28xx/em28xx-i2c.c
===================================================================
@@ -510,12 +510,17 @@
		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 @@

	[0x80 >> 1] = "msp34xx",
	[0x88 >> 1] = "msp34xx",
	[0xa0 >> 1] = "eeprom",
+	[0xb0 >> 1] = "tda9874",
	[0xb8 >> 1] = "tvp5150a",
	[0xba >> 1] = "tvp5150a",
	[0xc0 >> 1] = "tuner (analog)",
drivers/media/video/em28xx/em28xx-video.c +0 -0
Index: linux-next/drivers/media/video/em28xx/em28xx-video.c
===================================================================
@@ -540,6 +540,13 @@
			&route);
	}

+ if (dev->board.adecoder != EM28XX_NOADECODER) {
+ route.input = dev->ctl_ainput;
+ route.output = dev->ctl_aoutput;
+ em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING,
+ &route);
+ }
+

	em28xx_audio_analog_set(dev);
}
drivers/media/video/em28xx/em28xx.h +0 -0
Index: linux-next/drivers/media/video/em28xx/em28xx.h
===================================================================
@@ -374,6 +374,8 @@
	struct em28xx_reg_seq *dvb_gpio;
	struct em28xx_reg_seq *suspend_gpio;
	struct em28xx_reg_seq *tuner_gpio;

+ struct em28xx_reg_seq *mute_gpio;
+ struct em28xx_reg_seq *unmute_gpio;

	unsigned int is_em2800:1;
	unsigned int has_msp34xx:1;

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#1 lore raw
Quoted 17 lines · On Mon, 02 Mar 2009 17:58:13 +0300 Vitaly Wool <[email protected]> wrote:
drivers/media/video/em28xx/em28xx-core.c +4 -0
@@ -353,6 +353,7 @@
 {
 	int ret;
 	u8 input;
+	int do_mute = 0;
 
 	if (dev->board.is_em2800) {
 		if (dev->ctl_ainput == EM28XX_AMUX_VIDEO)
@@ -378,6 +379,16 @@
 		}
 	}
 
+	if (dev->mute || input != EM28XX_AUDIO_SRC_TUNER)
+		do_mute = 1;
+

drivers/media/video/em28xx/em28xx-core.c line 394

Quoted 10 lines
drivers/media/video/em28xx/em28xx-core.c +7 -0
+	if (dev->board.mute_gpio && do_mute)
+		em28xx_gpio_set(dev, dev->board.mute_gpio);
+
+	if (dev->board.unmute_gpio && !do_mute)
+		em28xx_gpio_set(dev, dev->board.unmute_gpio);
+
+
 	ret = em28xx_write_reg_bits(dev, EM28XX_R0E_AUDIOSRC, input, 0xc0);
 	if (ret < 0)
 		return ret;

This part of the patch doesn't seem correct. We should call the mute gpio only if dev->mute, since the mute condition has nothing to do with the selected input.

So, IMO, the above logic should be something like:

if (dev->mute)

	em28xx_gpio_set(dev, dev->board.mute_gpio);
else
	em28xx_gpio_set(dev, INPUT(dev->ctl_input)->gpio);

Some care should be taken, since the input gpio's are currently being set by em28xx_set_mode().

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#3 lore raw
Quoted 12 lines · On Tue, 03 Mar 2009 16:23:37 +0300 Vitaly Wool <[email protected]> wrote:
drivers/media/video/em28xx/em28xx-core.c +1 -0
@@ -353,6 +353,7 @@
 {
 	int ret;
 	u8 input;
+	int do_mute = 0;
 
 	if (dev->board.is_em2800) {
 		if (dev->ctl_ainput == EM28XX_AMUX_VIDEO)

drivers/media/video/em28xx/em28xx-core.c line 383

Quoted 5 lines
drivers/media/video/em28xx/em28xx-core.c +2 -0
@@ -378,6 +379,14 @@
 		}
 	}
 
+	if (dev->mute || input != EM28XX_AUDIO_SRC_TUNER)
+		do_mute = 1;

Do you really need the above line? This will reduce a lot the value of a mute callback, since it will not work for EM28XX_AUDIO_SRC_TUNER.

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list