Skip to contentSkip to conversation

Nova-S-Plus audio line input

linux-dvb Lawrence Rust 3 participants 8 messages Dec 18, 2008 – Jan 3, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

I have a Hauppauge Nova-S-plus PCI card and it works great with satellite reception. However, I would also like to use it with an external DVB-T box that outputs composite video and line audio but when I select the composite video input I can see a picture but get no sound.

I'm using kernel version 2.6.24 so I dug around those sources and I see in cx88-cards.c that there's no provision for line audio in. However, the latest v4l top of tree sources have added support for I2S audio input and 'audioroute's.

So I modded my 2.6.24 sources to support the external ADC and enable I2S audio input using the struct cx88_board cx88_boards.extadc flag, similar to the changes made in the current top of tree. This now means that I can watch DVB-T :-) I don't believe the changes affect any other cards.

I would like to see support added for the Nova-S-Plus audio line input in the kernel tree asap. What's the best way of achieving this? I can supply a diff for 2.6.24 or the current top of tree.

-- Lawrence Rust

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#1 lore raw

In message <[email protected]>, Lawrence Rust wrote:

hi

Quoted 10 lines

I have a Hauppauge Nova-S-plus PCI card and it works great with satellite reception. However, I would also like to use it with an external DVB-T box that outputs composite video and line audio but when I select the composite video input I can see a picture but get no sound.

I'm using kernel version 2.6.24 so I dug around those sources and I see in cx88-cards.c that there's no provision for line audio in. However, the latest v4l top of tree sources have added support for I2S audio input and 'audioroute's.

Quoted 8 lines

So I modded my 2.6.24 sources to support the external ADC and enable I2S audio input using the struct cx88_board cx88_boards.extadc flag, similar to the changes made in the current top of tree. This now means that I can watch DVB-T :-) I don't believe the changes affect any other cards.

I would like to see support added for the Nova-S-Plus audio line input in the kernel tree asap. What's the best way of achieving this? I can supply a diff for 2.6.24 or the current top of tree.

I would be interested to see what changes you made to achieve this and am able to test. Please share your patch for testing.

Thanks
darron

--

// /
{:)==={ Darron Broad <[email protected]>
\\ \

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#2 lore raw
Quoted 21 lines · On Thursday 18 December 2008 20:17:41 Darron Broad wrote:

hi

Quoted 10 lines

I have a Hauppauge Nova-S-plus PCI card and it works great with satellite reception. However, I would also like to use it with an external DVB-T box that outputs composite video and line audio but when I select the composite video input I can see a picture but get no sound.

I'm using kernel version 2.6.24 so I dug around those sources and I see in cx88-cards.c that there's no provision for line audio in. However, the latest v4l top of tree sources have added support for I2S audio input and 'audioroute's.

Quoted 8 lines

So I modded my 2.6.24 sources to support the external ADC and enable I2S audio input using the struct cx88_board cx88_boards.extadc flag, similar to the changes made in the current top of tree. This now means that I can watch DVB-T :-) I don't believe the changes affect any other cards.

I would like to see support added for the Nova-S-Plus audio line input in the kernel tree asap. What's the best way of achieving this? I can supply a diff for 2.6.24 or the current top of tree.

Quoted 5 lines

I would be interested to see what changes you made to achieve this and am able to test. Please share your patch for testing.

Thanks
darron

Diffs for linux kernel 2.6.24 and the current v4l tip attached.

The change for the current top of tree is minimal - just a few lines in the static configuration data of cx88-cards.c.

The changes for 2.6.24 parallel the changes made for audioroutes in the current tip.

Note the changes to cx88_alsa.c to remove the tuner volume control if there's no TV tuner and to re-group the switches more logically. I was thinking of adding some code to adjust the WM8775 gain - what do you think?

HTH.

-- Lawrence Rust

cx88-alsa.c +10 -8
diff -U 3 -H -w -d -r -N -- cx88.orig/cx88-alsa.c cx88/cx88-alsa.c
@@ -594,10 +594,10 @@
 	spin_lock_irq(&chip->reg_lock);
 	old = cx_read(AUD_VOL_CTL);
 	if (v != (old & 0x3f)) {
-	    cx_write(AUD_VOL_CTL, (old & ~0x3f) | v);
+	    cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, (old & ~0x3f) | v);
 	    changed = 1;
 	}
-	if (cx_read(AUD_BAL_CTL) != b) {
+	if ((cx_read(AUD_BAL_CTL) & 0x7f) != b) {
 	    cx_write(AUD_BAL_CTL, b);
 	    changed = 1;
 	}
@@ -612,7 +612,7 @@
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
 		  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
-	.name = "Playback Volume",
+	.name = "Tuner Volume",
 	.info = snd_cx88_volume_info,
 	.get = snd_cx88_volume_get,
 	.put = snd_cx88_volume_put,
@@ -643,7 +643,7 @@
 	vol = cx_read(AUD_VOL_CTL);
 	if (value->value.integer.value[0] != !(vol & bit)) {
 		vol ^= bit;
-		cx_write(AUD_VOL_CTL, vol);
+		cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol);
 		ret = 1;
 	}
 	spin_unlock_irq(&chip->reg_lock);
@@ -652,7 +652,7 @@
 
 static struct snd_kcontrol_new snd_cx88_dac_switch = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name = "Playback Switch",
+    .name = "Audio Out Switch",
 	.info = snd_ctl_boolean_mono_info,
 	.get = snd_cx88_switch_get,
 	.put = snd_cx88_switch_put,
@@ -661,7 +661,7 @@
 
 static struct snd_kcontrol_new snd_cx88_source_switch = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name = "Capture Switch",
+    .name = "Tuner Switch",
 	.info = snd_ctl_boolean_mono_info,
 	.get = snd_cx88_switch_get,
 	.put = snd_cx88_switch_put,
@@ -816,13 +816,15 @@
 	if (err < 0)
 		goto error;
 
+    if ( TUNER_ABSENT != chip->core->board.tuner_type || CX88_RADIO == chip->core->board.radio.type ) {
 	err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_volume, chip));
 	if (err < 0)
 		goto error;
-	err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_dac_switch, chip));
+        err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_source_switch, chip));
 	if (err < 0)
 		goto error;
-	err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_source_switch, chip));
+    }
+    err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_dac_switch, chip));
 	if (err < 0)
 		goto error;
 
cx88-cards.c +5 -1
diff -U 3 -H -w -d -r -N -- cx88.orig/cx88-cards.c cx88/cx88-cards.c
@@ -941,19 +941,23 @@
 	},
 	[CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1] = {
 		.name		= "Hauppauge Nova-S-Plus DVB-S",
-		.tuner_type	= TUNER_ABSENT,
+		.tuner_type	= UNSET, /* BUG: Needed by cx88_i2c_ini for WM8775 */
 		.radio_type	= UNSET,
 		.tuner_addr	= ADDR_UNSET,
 		.radio_addr	= ADDR_UNSET,
+		.audio_chip     = AUDIO_CHIP_WM8775,
 		.input		= {{
 			.type	= CX88_VMUX_DVB,
 			.vmux	= 0,
+			.extadc = 1,
 		},{
 			.type	= CX88_VMUX_COMPOSITE1,
 			.vmux	= 1,
+			.extadc = 1,
 		},{
 			.type	= CX88_VMUX_SVIDEO,
 			.vmux	= 2,
+			.extadc = 1,
 		}},
 		.mpeg           = CX88_MPEG_DVB,
 	},
cx88-tvaudio.c +11 -0
diff -U 3 -H -w -d -r -N -- cx88.orig/cx88-tvaudio.c cx88/cx88-tvaudio.c
@@ -767,6 +767,14 @@
 	case WW_FM:
 		set_audio_standard_FM(core, radio_deemphasis);
 		break;
+	case WW_I2SADC:
+		set_audio_start(core, 0x01);
+		/* Slave/Philips/Autobaud */
+		cx_write(AUD_I2SINPUTCNTL, 0);
+		/* Switch to "I2S ADC mode" */
+		cx_write(AUD_I2SCNTL, 0x1);
+		set_audio_finish(core, EN_I2SIN_ENABLE);
+		break;
 	case WW_NONE:
 	default:
 		printk("%s/0: unknown tv audio mode [%d]\n",
@@ -895,6 +903,9 @@
 			break;
 		}
 		break;
+	case WW_I2SADC:
+		/* DO NOTHING */
+		break;
 	}
 
 	if (UNSET != ctl) {
cx88-video.c +18 -5
diff -U 3 -H -w -d -r -N -- cx88.orig/cx88-video.c cx88/cx88-video.c
@@ -392,11 +392,17 @@
 		break;
 	}
 
-	if (core->board.mpeg & CX88_MPEG_BLACKBIRD) {
-		/* sets sound input from external adc */
-		if (INPUT(input).extadc)
-			cx_set(AUD_CTL, EN_I2SIN_ENABLE);
-		else
+	/* cx2388's C-ADC is connected to the tuner only.
+		When used with S-Video, that ADC is busy dealing with
+		chroma, so an external must be used for baseband audio.
+		So check if there is an external ADC for audio */
+	if ( INPUT(input).extadc && INPUT(input).type != CX88_VMUX_TELEVISION) {
+		/* "I2S ADC mode" */
+		core->tvaudio = WW_I2SADC;
+		cx88_set_tvaudio(core);
+	} else {
+		/* Normal mode */
+		cx_write(AUD_I2SCNTL, 0x0);
 			cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
 	}
 	return 0;
@@ -767,9 +773,16 @@
 		cx_write(MO_GP0_IO, core->board.radio.gpio0);
 		cx_write(MO_GP1_IO, core->board.radio.gpio1);
 		cx_write(MO_GP2_IO, core->board.radio.gpio2);
+		if (core->board.radio.extadc) {
+			/* "I2S ADC mode" */
+			core->tvaudio = WW_I2SADC;
+			cx88_set_tvaudio(core);
+		} else {
+			/* FM Mode */
 		core->tvaudio = WW_FM;
 		cx88_set_tvaudio(core);
 		cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1);
+		}
 		cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL);
 	}
 
cx88.h +1 -0
diff -U 3 -H -w -d -r -N -- cx88.orig/cx88.h cx88/cx88.h
@@ -604,6 +604,7 @@
 #define WW_EIAJ		 7
 #define WW_I2SPT	 8
 #define WW_FM		 9
+#define WW_I2SADC	 10
 
 void cx88_set_tvaudio(struct cx88_core *core);
 void cx88_newstation(struct cx88_core *core);
cx88-cards-new.c renamed from cx88-cards.c +5 -1
@@ -960,19 +960,23 @@
 	},
 	[CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1] = {
 		.name		= "Hauppauge Nova-S-Plus DVB-S",
-		.tuner_type	= TUNER_ABSENT,
+		.tuner_type	= UNSET, /* BUG: Needed by cx88_i2c_ini for WM8775 */
 		.radio_type	= UNSET,
 		.tuner_addr	= ADDR_UNSET,
 		.radio_addr	= ADDR_UNSET,
+        .audio_chip = V4L2_IDENT_WM8775,
 		.input		= {{
 			.type	= CX88_VMUX_DVB,
 			.vmux	= 0,
+            .audioroute = 1,
 		},{
 			.type	= CX88_VMUX_COMPOSITE1,
 			.vmux	= 1,
+            .audioroute = 1,
 		},{
 			.type	= CX88_VMUX_SVIDEO,
 			.vmux	= 2,
+            .audioroute = 1,
 		}},
 		.mpeg           = CX88_MPEG_DVB,
 	},

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#3 lore raw

In message <[email protected]>, Lawrence Rust wrote:

Hiya.

Quoted 33 lines · On Thursday 18 December 2008 20:17:41 Darron Broad wrote:
Quoted 21 lines

hi

Quoted 10 lines

I have a Hauppauge Nova-S-plus PCI card and it works great with satellite reception. However, I would also like to use it with an external DVB-T box that outputs composite video and line audio but when I select the composite video input I can see a picture but get no sound.

I'm using kernel version 2.6.24 so I dug around those sources and I see in cx88-cards.c that there's no provision for line audio in. However, the latest v4l top of tree sources have added support for I2S audio input and 'audioroute's.

Quoted 8 lines

So I modded my 2.6.24 sources to support the external ADC and enable I2S audio input using the struct cx88_board cx88_boards.extadc flag, similar to the changes made in the current top of tree. This now means that I can watch DVB-T :-) I don't believe the changes affect any other cards.

I would like to see support added for the Nova-S-Plus audio line input in the kernel tree asap. What's the best way of achieving this? I can supply a diff for 2.6.24 or the current top of tree.

Quoted 5 lines

I would be interested to see what changes you made to achieve this and am able to test. Please share your patch for testing.

Thanks
darron

Diffs for linux kernel 2.6.24 and the current v4l tip attached.

The change for the current top of tree is minimal - just a few lines in the static configuration data of cx88-cards.c.

Quoted 8 lines

The changes for 2.6.24 parallel the changes made for audioroutes in the current tip.

Note the changes to cx88_alsa.c to remove the tuner volume control if there's no TV tuner and to re-group the switches more logically. I was thinking of adding some code to adjust the WM8775 gain - what do you think?

HTH.

Thanks for that Lawrence. I will test this soon.

With regard to the gain control on the WM8775, perhaps you can look at this:

http://hg.kewl.org/v4l-dvb-test/shortlog

You can find some patches here:
http://hg.kewl.org/v4l-dvb-test/rev/c1d603af3bef
http://hg.kewl.org/v4l-dvb-test/rev/302d51bf2baf
http://hg.kewl.org/v4l-dvb-test/rev/8b24b8211fc9

Which sound like they would do what you desire?

I should rebuild these patches soon to for better testing purposes but in the meantime please test if you are interested.

Cheers

darron

Quoted 1 line

-- Lawrence Rust

<snip>

--

// /
{:)==={ Darron Broad <[email protected]>
\\ \

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#4 lore raw
Quoted 36 lines · On Friday 19 December 2008 11:41:51 Darron Broad wrote:

In message <[email protected]>, Lawrence Rust wrote:

Hiya.

Quoted 31 lines · On Thursday 18 December 2008 20:17:41 Darron Broad wrote:
Quoted 23 lines

hi

Quoted 17 lines

I have a Hauppauge Nova-S-plus PCI card and it works great with satellite reception. However, I would also like to use it with an external DVB-T box that outputs composite video and line audio but when I select the composite video input I can see a picture but get no sound.

I'm using kernel version 2.6.24 so I dug around those sources and I see in cx88-cards.c that there's no provision for line audio in. However, the latest v4l top of tree sources have added support for I2S audio input and 'audioroute's.

So I modded my 2.6.24 sources to support the external ADC and enable I2S audio input using the struct cx88_board cx88_boards.extadc flag, similar to the changes made in the current top of tree. This now means that I can watch DVB-T :-) I don't believe the changes affect any other cards.

Quoted 3 lines

I would like to see support added for the Nova-S-Plus audio line input in the kernel tree asap. What's the best way of achieving this? I can supply a diff for 2.6.24 or the current top of tree.

Quoted 5 lines

I would be interested to see what changes you made to achieve this and am able to test. Please share your patch for testing.

Thanks
darron

Diffs for linux kernel 2.6.24 andcd out/linux.x86/release/bin/src the

current v4l tip attached.

Quoted 26 lines
Quoted 7 lines

The change for the current top of tree is minimal - just a few lines in the static configuration data of cx88-cards.c.

The changes for 2.6.24 parallel the changes made for audioroutes in the current tip.

Quoted 6 lines

Note the changes to cx88_alsa.c to remove the tuner volume control if there's no TV tuner and to re-group the switches more logically. I was thinking of adding some code to adjust the WM8775 gain - what do you think?

HTH.

Thanks for that Lawrence. I will test this soon.

With regard to the gain control on the WM8775, perhaps you can look at this:

http://hg.kewl.org/v4l-dvb-test/shortlog

You can find some patches here:
http://hg.kewl.org/v4l-dvb-test/rev/c1d603af3bef
http://hg.kewl.org/v4l-dvb-test/rev/302d51bf2baf
http://hg.kewl.org/v4l-dvb-test/rev/8b24b8211fc9

Quoted 4 lines

Which sound like they would do what you desire?

I should rebuild these patches soon to for better testing purposes but in the meantime please test if you are interested.

Yes, these patches look _exactly_ like what I was thinking of. The control of audio overload was my main priority, together with a nice ALSA interface. I'll give them a try and report back.

NB I can build current top of tree, but I'm only testing with my Nova card on kernel 2.6.24. I don't have a proper test m/c setup to try anything too bleeding edge.

Thanks.

-- Lawrence Rust

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#5 lore raw

Hi

I have the same pci card, it does not work under kernel 2.6.27 .. Do you think I should consider downgrading to 2.624 or something could be done to get the card supported under recent kernels ?

Thx

Signature · 6 lines
 Roland "TTK".

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
#6 lore raw
Quoted 6 lines · On Saturday 20 December 2008 09:32:58 Roland HAMON wrote:

Hi

I have the same pci card, it does not work under kernel 2.6.27 .. Do you think I should consider downgrading to 2.624 or something could be done to get the card supported under recent kernels ?

The attached diff should work with kernel 2.6.27. The v4l drivers in this version are similar to top of tree but are missing I2S support in cx88-tvaudio.

The patch to cx88_alsa is optional. It just removes the non-functional tuner volume controls in preparation for the changes that I'm working on for the wm8775 audio front end.

NB I'm unable to test this patch since I'm still running kernel 2.6.24 but I tested that it does compile with the original 2.6.27 unpatched kernel sources. I would like to upgrade to Kubuntu 8.10 (with kernel 2.6.27) but it comes with KDE 4, which I cannot abide, shame. Thinking of going back to plain Ubuntu for 8.10 and on but I'll miss many KDE apps - what a quandary.

-- Lawrence Rust

cx88-alsa.c +10 -8
diff -U 3 -H -w -d -r -N -- cx88-orig/cx88-alsa.c cx88/cx88-alsa.c
@@ -598,10 +598,10 @@
 	spin_lock_irq(&chip->reg_lock);
 	old = cx_read(AUD_VOL_CTL);
 	if (v != (old & 0x3f)) {
-	    cx_write(AUD_VOL_CTL, (old & ~0x3f) | v);
+	    cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, (old & ~0x3f) | v);
 	    changed = 1;
 	}
-	if (cx_read(AUD_BAL_CTL) != b) {
+	if ((cx_read(AUD_BAL_CTL) & 0x7f) != b) {
 	    cx_write(AUD_BAL_CTL, b);
 	    changed = 1;
 	}
@@ -616,7 +616,7 @@
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
 		  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
-	.name = "Playback Volume",
+	.name = "Tuner Volume",
 	.info = snd_cx88_volume_info,
 	.get = snd_cx88_volume_get,
 	.put = snd_cx88_volume_put,
@@ -647,7 +647,7 @@
 	vol = cx_read(AUD_VOL_CTL);
 	if (value->value.integer.value[0] != !(vol & bit)) {
 		vol ^= bit;
-		cx_write(AUD_VOL_CTL, vol);
+		cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol);
 		ret = 1;
 	}
 	spin_unlock_irq(&chip->reg_lock);
@@ -656,7 +656,7 @@
 
 static struct snd_kcontrol_new snd_cx88_dac_switch = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name = "Playback Switch",
+    .name = "Audio Out Switch",
 	.info = snd_ctl_boolean_mono_info,
 	.get = snd_cx88_switch_get,
 	.put = snd_cx88_switch_put,
@@ -665,7 +665,7 @@
 
 static struct snd_kcontrol_new snd_cx88_source_switch = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name = "Capture Switch",
+    .name = "Tuner Switch",
 	.info = snd_ctl_boolean_mono_info,
 	.get = snd_cx88_switch_get,
 	.put = snd_cx88_switch_put,
@@ -818,13 +818,15 @@
 	if (err < 0)
 		goto error;
 
+    if ( TUNER_ABSENT != chip->core->board.tuner_type || CX88_RADIO == chip->core->board.radio.type ) {
 	err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_volume, chip));
 	if (err < 0)
 		goto error;
-	err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_dac_switch, chip));
+        err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_source_switch, chip));
 	if (err < 0)
 		goto error;
-	err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_source_switch, chip));
+    }
+    err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_dac_switch, chip));
 	if (err < 0)
 		goto error;
 
cx88-cards.c +5 -1
diff -U 3 -H -w -d -r -N -- cx88-orig/cx88-cards.c cx88/cx88-cards.c
@@ -959,19 +959,23 @@
 	},
 	[CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1] = {
 		.name		= "Hauppauge Nova-S-Plus DVB-S",
-		.tuner_type	= TUNER_ABSENT,
+		.tuner_type	= UNSET, /* BUG: Needed by cx88_i2c_ini for WM8775 */
 		.radio_type	= UNSET,
 		.tuner_addr	= ADDR_UNSET,
 		.radio_addr	= ADDR_UNSET,
+		.audio_chip     = V4L2_IDENT_WM8775,
 		.input		= {{
 			.type	= CX88_VMUX_DVB,
 			.vmux	= 0,
+			.audioroute = 2,
 		},{
 			.type	= CX88_VMUX_COMPOSITE1,
 			.vmux	= 1,
+			.audioroute = 2,
 		},{
 			.type	= CX88_VMUX_SVIDEO,
 			.vmux	= 2,
+			.audioroute = 2,
 		}},
 		.mpeg           = CX88_MPEG_DVB,
 	},
cx88-tvaudio.c +11 -0
diff -U 3 -H -w -d -r -N -- cx88-orig/cx88-tvaudio.c cx88/cx88-tvaudio.c
@@ -767,6 +767,14 @@
 	case WW_FM:
 		set_audio_standard_FM(core, radio_deemphasis);
 		break;
+	case WW_I2SADC:
+		set_audio_start(core, 0x01);
+		/* Slave/Philips/Autobaud */
+		cx_write(AUD_I2SINPUTCNTL, 0);
+		/* Switch to "I2S ADC mode" */
+		cx_write(AUD_I2SCNTL, 0x1);
+		set_audio_finish(core, EN_I2SIN_ENABLE);
+		break;
 	case WW_NONE:
 	default:
 		printk("%s/0: unknown tv audio mode [%d]\n",
@@ -895,6 +903,9 @@
 			break;
 		}
 		break;
+	case WW_I2SADC:
+		/* DO NOTHING */
+		break;
 	}
 
 	if (UNSET != ctl) {
cx88-video.c +10 -3
diff -U 3 -H -w -d -r -N -- cx88-orig/cx88-video.c cx88/cx88-video.c
@@ -435,9 +435,9 @@
 
 		if (INPUT(input).type != CX88_VMUX_TELEVISION &&
 			INPUT(input).type != CX88_RADIO) {
-			/* "ADC mode" */
-			cx_write(AUD_I2SCNTL, 0x1);
-			cx_set(AUD_CTL, EN_I2SIN_ENABLE);
+			/* "I2S ADC mode" */
+			core->tvaudio = WW_I2SADC;
+			cx88_set_tvaudio(core);
 		} else {
 			/* Normal mode */
 			cx_write(AUD_I2SCNTL, 0x0);
@@ -827,9 +827,16 @@
 		cx_write(MO_GP0_IO, core->board.radio.gpio0);
 		cx_write(MO_GP1_IO, core->board.radio.gpio1);
 		cx_write(MO_GP2_IO, core->board.radio.gpio2);
+		if (core->board.radio.audioroute) {
+			/* "I2S ADC mode" */
+			core->tvaudio = WW_I2SADC;
+			cx88_set_tvaudio(core);
+		} else {
+			/* FM Mode */
 		core->tvaudio = WW_FM;
 		cx88_set_tvaudio(core);
 		cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1);
+		}
 		cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL);
 	}
 
cx88.h +1 -0
diff -U 3 -H -w -d -r -N -- cx88-orig/cx88.h cx88/cx88.h
@@ -619,6 +619,7 @@
 #define WW_EIAJ		 7
 #define WW_I2SPT	 8
 #define WW_FM		 9
+#define WW_I2SADC	 10
 
 void cx88_set_tvaudio(struct cx88_core *core);
 void cx88_newstation(struct cx88_core *core);

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#7 lore raw
In reply to Darron Broad
Quoted 62 lines · On Friday 19 December 2008 11:41:51 Darron Broad wrote:

In message <[email protected]>, Lawrence Rust wrote:

Hiya.

Quoted 38 lines · On Thursday 18 December 2008 20:17:41 Darron Broad wrote:
Quoted 23 lines

hi

Quoted 17 lines

I have a Hauppauge Nova-S-plus PCI card and it works great with satellite reception. However, I would also like to use it with an external DVB-T box that outputs composite video and line audio but when I select the composite video input I can see a picture but get no sound.

I'm using kernel version 2.6.24 so I dug around those sources and I see in cx88-cards.c that there's no provision for line audio in. However, the latest v4l top of tree sources have added support for I2S audio input and 'audioroute's.

So I modded my 2.6.24 sources to support the external ADC and enable I2S audio input using the struct cx88_board cx88_boards.extadc flag, similar to the changes made in the current top of tree. This now means that I can watch DVB-T :-) I don't believe the changes affect any other cards.

Quoted 3 lines

I would like to see support added for the Nova-S-Plus audio line input in the kernel tree asap. What's the best way of achieving this? I can supply a diff for 2.6.24 or the current top of tree.

Quoted 5 lines

I would be interested to see what changes you made to achieve this and am able to test. Please share your patch for testing.

Thanks
darron

Diffs for linux kernel 2.6.24 and the current v4l tip attached.

The change for the current top of tree is minimal - just a few lines in the static configuration data of cx88-cards.c.

The changes for 2.6.24 parallel the changes made for audioroutes in the current tip.

Quoted 6 lines

Note the changes to cx88_alsa.c to remove the tuner volume control if there's no TV tuner and to re-group the switches more logically. I was thinking of adding some code to adjust the WM8775 gain - what do you think?

HTH.

Thanks for that Lawrence. I will test this soon.

With regard to the gain control on the WM8775, perhaps you can look at this:

http://hg.kewl.org/v4l-dvb-test/shortlog

You can find some patches here:
http://hg.kewl.org/v4l-dvb-test/rev/c1d603af3bef
http://hg.kewl.org/v4l-dvb-test/rev/302d51bf2baf
http://hg.kewl.org/v4l-dvb-test/rev/8b24b8211fc9

Quoted 8 lines

Which sound like they would do what you desire?

I should rebuild these patches soon to for better testing purposes but in the meantime please test if you are interested.

Cheers

darron

Darron,

I've been running those patches for the last week now with no problems. I did find that L-R balance wasn't working properly but it's a simple fix.

I also patched cx88-alsa.c so that I could use an ALSA GUI (kmix) to set the input level. There's very little difference in this file between 2.6.24 and top of tree so the patch should be OK for most versions.

Patches for 2.6.24 attached. The patch to wm8775.c is pretty similar to your original but with these small changes:

- The wm98875 is initialised in I2S mode, not left justified, for proper operation with the cx88.

- The ALC setup code is left in but conditionally compiled out rather than removed - in case someone should prefer ALC.

- wm8775_set_audio doesn't set the LRBOTH bit in R21. This fixes the problem with balance.

-- Lawrence Rust

cx88/cx88-alsa.c +40 -8
diff -U 3 -H -w -d -r -N -- video.orig/cx88/cx88-alsa.c video/cx88/cx88-alsa.c
@@ -583,6 +583,30 @@
 	int changed = 0;
 	u32 old;
 
+    /* If a WM8775 is used for audio input utilise the audio controls */
+    if ( core->board.audio_chip && core->board.audio_chip == AUDIO_CHIP_WM8775) {
+        struct v4l2_control client_ctl;
+
+        if ( value->value.integer.value[0] >= value->value.integer.value[1]) {
+            v = value->value.integer.value[0] << 10;
+            b = value->value.integer.value[0] ?
+              (0x8000 * value->value.integer.value[1]) / value->value.integer.value[0] :
+              0x8000;
+        } else {
+            v = value->value.integer.value[1] << 10;
+            b = value->value.integer.value[1] ?
+              0xffff - (0x8000 * value->value.integer.value[0]) / value->value.integer.value[1] :
+              0x8000;
+        }
+        client_ctl.value = v;
+        client_ctl.id = V4L2_CID_AUDIO_VOLUME;
+        cx88_call_i2c_clients(core, VIDIOC_S_CTRL, &client_ctl);
+
+        client_ctl.value = b;
+        client_ctl.id = V4L2_CID_AUDIO_BALANCE;
+        cx88_call_i2c_clients(core, VIDIOC_S_CTRL, &client_ctl);
+    }
+
 	b = value->value.integer.value[1] - value->value.integer.value[0];
 	if (b < 0) {
 	    v = 0x3f - value->value.integer.value[0];
@@ -594,10 +618,10 @@
 	spin_lock_irq(&chip->reg_lock);
 	old = cx_read(AUD_VOL_CTL);
 	if (v != (old & 0x3f)) {
-	    cx_write(AUD_VOL_CTL, (old & ~0x3f) | v);
+	    cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, (old & ~0x3f) | v);
 	    changed = 1;
 	}
-	if (cx_read(AUD_BAL_CTL) != b) {
+	if ((cx_read(AUD_BAL_CTL) & 0x7f) != b) {
 	    cx_write(AUD_BAL_CTL, b);
 	    changed = 1;
 	}
@@ -612,7 +636,7 @@
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
 		  SNDRV_CTL_ELEM_ACCESS_TLV_READ,
-	.name = "Playback Volume",
+	.name = "Tuner Volume",
 	.info = snd_cx88_volume_info,
 	.get = snd_cx88_volume_get,
 	.put = snd_cx88_volume_put,
@@ -643,7 +667,15 @@
 	vol = cx_read(AUD_VOL_CTL);
 	if (value->value.integer.value[0] != !(vol & bit)) {
 		vol ^= bit;
-		cx_write(AUD_VOL_CTL, vol);
+		cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol);
+
+        /* If a WM8775 is used for audio input utilise the audio controls */
+        if ( (1<<6) == bit && core->board.audio_chip && core->board.audio_chip == AUDIO_CHIP_WM8775) {
+            struct v4l2_control client_ctl;
+            client_ctl.value = 0 == value->value.integer.value[0];
+            client_ctl.id = V4L2_CID_AUDIO_MUTE;
+            cx88_call_i2c_clients(core, VIDIOC_S_CTRL, &client_ctl);
+        }
 		ret = 1;
 	}
 	spin_unlock_irq(&chip->reg_lock);
@@ -652,7 +684,7 @@
 
 static struct snd_kcontrol_new snd_cx88_dac_switch = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name = "Playback Switch",
+    .name = "Audio Out Switch",
 	.info = snd_ctl_boolean_mono_info,
 	.get = snd_cx88_switch_get,
 	.put = snd_cx88_switch_put,
@@ -661,7 +693,7 @@
 
 static struct snd_kcontrol_new snd_cx88_source_switch = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name = "Capture Switch",
+    .name = "Tuner Switch",
 	.info = snd_ctl_boolean_mono_info,
 	.get = snd_cx88_switch_get,
 	.put = snd_cx88_switch_put,
@@ -819,10 +851,10 @@
 	err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_volume, chip));
 	if (err < 0)
 		goto error;
-	err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_dac_switch, chip));
+    err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_source_switch, chip));
 	if (err < 0)
 		goto error;
-	err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_source_switch, chip));
+    err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_dac_switch, chip));
 	if (err < 0)
 		goto error;
 
wm8775.c +112 -36

197 lines not on this page · raw message

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb