* [linux-dvb] Nova-S-Plus audio line input @ 2008-12-18 17:04 Lawrence Rust 2008-12-18 19:17 ` Darron Broad 0 siblings, 1 reply; 8+ messages in thread From: Lawrence Rust @ 2008-12-18 17:04 UTC (permalink / raw) To: Linux-dvb list 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 linux-dvb@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [linux-dvb] Nova-S-Plus audio line input 2008-12-18 17:04 [linux-dvb] Nova-S-Plus audio line input Lawrence Rust @ 2008-12-18 19:17 ` Darron Broad 2008-12-19 10:27 ` Lawrence Rust 0 siblings, 1 reply; 8+ messages in thread From: Darron Broad @ 2008-12-18 19:17 UTC (permalink / raw) To: Lawrence Rust; +Cc: Linux-dvb list In message <200812181804.34557.lawrence@softsystem.co.uk>, Lawrence Rust wrote: hi >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. 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 <darron@kewl.org> \\ \ _______________________________________________ linux-dvb mailing list linux-dvb@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [linux-dvb] Nova-S-Plus audio line input 2008-12-18 19:17 ` Darron Broad @ 2008-12-19 10:27 ` Lawrence Rust 2008-12-19 10:41 ` Darron Broad 0 siblings, 1 reply; 8+ messages in thread From: Lawrence Rust @ 2008-12-19 10:27 UTC (permalink / raw) To: Darron Broad; +Cc: Linux-dvb list [-- Attachment #1: Type: text/plain, Size: 1796 bytes --] On Thursday 18 December 2008 20:17:41 Darron Broad wrote: > hi > > >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. > > 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 [-- Attachment #2: cx88-2.6.24.diff --] [-- Type: text/x-diff, Size: 5537 bytes --] diff -U 3 -H -w -d -r -N -- cx88.orig/cx88-alsa.c cx88/cx88-alsa.c --- cx88.orig/cx88-alsa.c 2008-02-11 06:51:11.000000000 +0100 +++ cx88/cx88-alsa.c 2008-12-19 10:48:25.000000000 +0100 @@ -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; diff -U 3 -H -w -d -r -N -- cx88.orig/cx88-cards.c cx88/cx88-cards.c --- cx88.orig/cx88-cards.c 2008-12-15 09:48:12.000000000 +0100 +++ cx88/cx88-cards.c 2008-12-19 10:43:37.000000000 +0100 @@ -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, }, diff -U 3 -H -w -d -r -N -- cx88.orig/cx88-tvaudio.c cx88/cx88-tvaudio.c --- cx88.orig/cx88-tvaudio.c 2008-02-11 06:51:11.000000000 +0100 +++ cx88/cx88-tvaudio.c 2008-12-19 10:43:37.000000000 +0100 @@ -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) { diff -U 3 -H -w -d -r -N -- cx88.orig/cx88-video.c cx88/cx88-video.c --- cx88.orig/cx88-video.c 2008-02-11 06:51:11.000000000 +0100 +++ cx88/cx88-video.c 2008-12-19 10:53:54.000000000 +0100 @@ -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); } diff -U 3 -H -w -d -r -N -- cx88.orig/cx88.h cx88/cx88.h --- cx88.orig/cx88.h 2008-02-11 06:51:11.000000000 +0100 +++ cx88/cx88.h 2008-12-15 18:06:27.000000000 +0100 @@ -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); [-- Attachment #3: cx88-tip.diff --] [-- Type: text/x-diff, Size: 750 bytes --] --- cx88-cards.c 2008-12-14 12:28:07.000000000 +0100 +++ cx88-cards-new.c 2008-12-19 10:34:20.000000000 +0100 @@ -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, }, [-- Attachment #4: Type: text/plain, Size: 150 bytes --] _______________________________________________ linux-dvb mailing list linux-dvb@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [linux-dvb] Nova-S-Plus audio line input 2008-12-19 10:27 ` Lawrence Rust @ 2008-12-19 10:41 ` Darron Broad 2008-12-19 11:16 ` Lawrence Rust 2009-01-03 11:20 ` Lawrence Rust 0 siblings, 2 replies; 8+ messages in thread From: Darron Broad @ 2008-12-19 10:41 UTC (permalink / raw) To: Lawrence Rust; +Cc: Linux-dvb list In message <200812191127.35952.lawrence@softsystem.co.uk>, Lawrence Rust wrote: Hiya. >On Thursday 18 December 2008 20:17:41 Darron Broad wrote: >> hi >> >> >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. >> >> 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. 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 >-- Lawrence Rust <snip> -- // / {:)==={ Darron Broad <darron@kewl.org> \\ \ _______________________________________________ linux-dvb mailing list linux-dvb@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [linux-dvb] Nova-S-Plus audio line input 2008-12-19 10:41 ` Darron Broad @ 2008-12-19 11:16 ` Lawrence Rust 2008-12-20 8:32 ` Roland HAMON 2009-01-03 11:20 ` Lawrence Rust 1 sibling, 1 reply; 8+ messages in thread From: Lawrence Rust @ 2008-12-19 11:16 UTC (permalink / raw) To: Darron Broad; +Cc: Linux-dvb list On Friday 19 December 2008 11:41:51 Darron Broad wrote: > In message <200812191127.35952.lawrence@softsystem.co.uk>, Lawrence Rust > wrote: > > Hiya. > > >On Thursday 18 December 2008 20:17:41 Darron Broad wrote: > >> hi > >> > >> >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. > >> > >> 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. > > > >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. > > 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. 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 linux-dvb@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [linux-dvb] Nova-S-Plus audio line input 2008-12-19 11:16 ` Lawrence Rust @ 2008-12-20 8:32 ` Roland HAMON 2008-12-20 10:59 ` Lawrence Rust 0 siblings, 1 reply; 8+ messages in thread From: Roland HAMON @ 2008-12-20 8:32 UTC (permalink / raw) To: Linux-dvb list 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 -- Roland "TTK". _______________________________________________ linux-dvb mailing list linux-dvb@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [linux-dvb] Nova-S-Plus audio line input 2008-12-20 8:32 ` Roland HAMON @ 2008-12-20 10:59 ` Lawrence Rust 0 siblings, 0 replies; 8+ messages in thread From: Lawrence Rust @ 2008-12-20 10:59 UTC (permalink / raw) To: linux-dvb [-- Attachment #1: Type: text/plain, Size: 1003 bytes --] 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 [-- Attachment #2: cx88-2.6.27.diff --] [-- Type: text/x-diff, Size: 5207 bytes --] diff -U 3 -H -w -d -r -N -- cx88-orig/cx88-alsa.c cx88/cx88-alsa.c --- cx88-orig/cx88-alsa.c 2008-10-10 00:13:53.000000000 +0200 +++ cx88/cx88-alsa.c 2008-12-20 10:53:25.000000000 +0100 @@ -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; diff -U 3 -H -w -d -r -N -- cx88-orig/cx88-cards.c cx88/cx88-cards.c --- cx88-orig/cx88-cards.c 2008-10-10 00:13:53.000000000 +0200 +++ cx88/cx88-cards.c 2008-12-20 11:01:46.000000000 +0100 @@ -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, }, diff -U 3 -H -w -d -r -N -- cx88-orig/cx88-tvaudio.c cx88/cx88-tvaudio.c --- cx88-orig/cx88-tvaudio.c 2008-10-10 00:13:53.000000000 +0200 +++ cx88/cx88-tvaudio.c 2008-12-20 10:53:25.000000000 +0100 @@ -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) { diff -U 3 -H -w -d -r -N -- cx88-orig/cx88-video.c cx88/cx88-video.c --- cx88-orig/cx88-video.c 2008-10-10 00:13:53.000000000 +0200 +++ cx88/cx88-video.c 2008-12-20 11:01:30.000000000 +0100 @@ -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); } diff -U 3 -H -w -d -r -N -- cx88-orig/cx88.h cx88/cx88.h --- cx88-orig/cx88.h 2008-10-10 00:13:53.000000000 +0200 +++ cx88/cx88.h 2008-12-20 10:53:25.000000000 +0100 @@ -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); [-- Attachment #3: Type: text/plain, Size: 150 bytes --] _______________________________________________ linux-dvb mailing list linux-dvb@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [linux-dvb] Nova-S-Plus audio line input 2008-12-19 10:41 ` Darron Broad 2008-12-19 11:16 ` Lawrence Rust @ 2009-01-03 11:20 ` Lawrence Rust 1 sibling, 0 replies; 8+ messages in thread From: Lawrence Rust @ 2009-01-03 11:20 UTC (permalink / raw) To: Darron Broad; +Cc: Linux-dvb list [-- Attachment #1: Type: text/plain, Size: 3472 bytes --] On Friday 19 December 2008 11:41:51 Darron Broad wrote: > In message <200812191127.35952.lawrence@softsystem.co.uk>, Lawrence Rust > wrote: > > Hiya. > > >On Thursday 18 December 2008 20:17:41 Darron Broad wrote: > >> hi > >> > >> >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. > >> > >> 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. > > 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 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 [-- Attachment #2: novaS-audio-2.6.24.diff --] [-- Type: text/x-diff, Size: 10690 bytes --] diff -U 3 -H -w -d -r -N -- video.orig/cx88/cx88-alsa.c video/cx88/cx88-alsa.c --- video.orig/cx88/cx88-alsa.c 2008-02-11 06:51:11.000000000 +0100 +++ video/cx88/cx88-alsa.c 2008-12-31 16:41:15.000000000 +0100 @@ -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; diff -U 3 -H -w -d -r -N -- video.orig/wm8775.c video/wm8775.c --- video.orig/wm8775.c 2008-02-11 06:51:11.000000000 +0100 +++ video/wm8775.c 2009-01-01 13:35:30.000000000 +0100 @@ -55,6 +55,8 @@ struct wm8775_state { u8 input; /* Last selected input (0-0xf) */ u8 muted; + u16 volume; + u16 balance; }; static int wm8775_write(struct i2c_client *client, int reg, u16 val) @@ -76,6 +78,57 @@ return -1; } +static void wm8775_set_audio(struct i2c_client *client) +{ + struct wm8775_state *state = i2c_get_clientdata(client); + u8 vol_l, vol_r; + + /* normalize ( 65535 to 0 -> 255 to 0 (+24dB to -103dB) ) */ + vol_l = ((min(65536 - state->balance, 32768) * state->volume) / 32768) >> 8; + vol_r = ((min(state->balance, (u16)32768) * state->volume) / 32768) >> 8; + + /* Mute */ + wm8775_write(client, R21, 0x0c0); + + wm8775_write(client, R14, vol_l); + wm8775_write(client, R15, vol_r); + + /* Un-mute */ + if (!state->muted) + wm8775_write(client, R21, state->input); +} + +static struct v4l2_queryctrl wm8775_qctrl[] = { + { + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 65535, + .step = 65535/100, + .default_value = 0xCF00, /* 0 dB */ + .flags = 0, + .type = V4L2_CTRL_TYPE_INTEGER, + }, { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 1, + .flags = 0, + .type = V4L2_CTRL_TYPE_BOOLEAN, + }, { + .id = V4L2_CID_AUDIO_BALANCE, + .name = "Balance", + .minimum = 0, + .maximum = 65535, + .step = 65535/100, + .default_value = 32768, + .flags = 0, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; + static int wm8775_command(struct i2c_client *client, unsigned int cmd, void *arg) { @@ -100,37 +153,65 @@ return -EINVAL; } state->input = route->input; - if (state->muted) - break; - wm8775_write(client, R21, 0x0c0); - wm8775_write(client, R14, 0x1d4); - wm8775_write(client, R15, 0x1d4); - wm8775_write(client, R21, 0x100 + state->input); + wm8775_set_audio(client); break; case VIDIOC_G_CTRL: - if (ctrl->id != V4L2_CID_AUDIO_MUTE) - return -EINVAL; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: ctrl->value = state->muted; break; - case VIDIOC_S_CTRL: - if (ctrl->id != V4L2_CID_AUDIO_MUTE) + case V4L2_CID_AUDIO_VOLUME: + ctrl->value = state->volume; + break; + + case V4L2_CID_AUDIO_BALANCE: + ctrl->value = state->balance; + break; + + default: return -EINVAL; + } + break; + + case VIDIOC_S_CTRL: + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: state->muted = ctrl->value; - wm8775_write(client, R21, 0x0c0); - wm8775_write(client, R14, 0x1d4); - wm8775_write(client, R15, 0x1d4); - if (!state->muted) - wm8775_write(client, R21, 0x100 + state->input); break; - case VIDIOC_G_CHIP_IDENT: - return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_WM8775, 0); + case V4L2_CID_AUDIO_VOLUME: + state->volume = ctrl->value; + break; + + case V4L2_CID_AUDIO_BALANCE: + state->balance = ctrl->value; + break; + + default: + return -EINVAL; + } + wm8775_set_audio(client); + break; + + case VIDIOC_QUERYCTRL: + { + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(wm8775_qctrl); i++) + if (qc->id && qc->id == wm8775_qctrl[i].id) { + memcpy(qc, &wm8775_qctrl[i], sizeof(*qc)); + return 0; + } + return -EINVAL; + } case VIDIOC_LOG_STATUS: - v4l_info(client, "Input: %d%s\n", state->input, - state->muted ? " (muted)" : ""); + v4l_info(client, "Volume: %04x%s Balance: %04x Input: %d\n", + state->volume, state->muted ? " (muted)" : "", + state->balance, state->input); break; case VIDIOC_S_FREQUENCY: @@ -138,10 +219,7 @@ sound the first time I tune from static to a valid channel. It's difficult to reproduce and is almost certainly related to the zero cross detect circuit. */ - wm8775_write(client, R21, 0x0c0); - wm8775_write(client, R14, 0x1d4); - wm8775_write(client, R15, 0x1d4); - wm8775_write(client, R21, 0x100 + state->input); + wm8775_set_audio(client); break; default: @@ -188,26 +266,24 @@ } state->input = 2; state->muted = 0; + state->volume = 0xCF00; + state->balance = 0x8000; i2c_set_clientdata(client, state); /* initialize wm8775 */ wm8775_write(client, R23, 0x000); /* RESET */ - wm8775_write(client, R7, 0x000); /* Disable zero cross detect timeout */ - wm8775_write(client, R11, 0x021); /* Left justified, 24-bit mode */ + /*wm8775_write(client, R7, 0x000); /* Enable zero cross detect timeout */ + wm8775_write(client, R11, 0x022); /* HPF enable, I2S mode, 24-bit */ wm8775_write(client, R12, 0x102); /* Master mode, clock ratio 256fs */ wm8775_write(client, R13, 0x000); /* Powered up */ - wm8775_write(client, R14, 0x1d4); /* ADC gain +2.5dB, enable zero cross */ - wm8775_write(client, R15, 0x1d4); /* ADC gain +2.5dB, enable zero cross */ - wm8775_write(client, R16, 0x1bf); /* ALC Stereo, ALC target level -1dB FS */ - /* max gain +8dB */ - wm8775_write(client, R17, 0x185); /* Enable gain control, use zero cross */ - /* detection, ALC hold time 42.6 ms */ - wm8775_write(client, R18, 0x0a2); /* ALC gain ramp up delay 34 s, */ - /* ALC gain ramp down delay 33 ms */ + wm8775_set_audio(client); /* set volume/mute */ +#if 0 /* Enable ALC */ + wm8775_write(client, R16, 0x1bb); /* ALC stereo, ALC target level -5dB FS, ALC max gain +8dB */ + wm8775_write(client, R17, 0x185); /* Enable LC, use zero cross, ALC hold 42.7 ms */ + wm8775_write(client, R18, 0x0a2); /* ALC decay time 34 s, ALC attack time 33 ms */ wm8775_write(client, R19, 0x005); /* Enable noise gate, threshold -72dBfs */ - wm8775_write(client, R20, 0x07a); /* Transient window 4ms, lower PGA gain */ - /* limit -1dB */ - wm8775_write(client, R21, 0x102); /* LRBOTH = 1, use input 2. */ + wm8775_write(client, R20, 0x0fb); /* Transient window 4ms, ALC min gain -5dB */ +#endif i2c_attach_client(client); return 0; [-- Attachment #3: Type: text/plain, Size: 150 bytes --] _______________________________________________ linux-dvb mailing list linux-dvb@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-01-03 11:21 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-12-18 17:04 [linux-dvb] Nova-S-Plus audio line input Lawrence Rust 2008-12-18 19:17 ` Darron Broad 2008-12-19 10:27 ` Lawrence Rust 2008-12-19 10:41 ` Darron Broad 2008-12-19 11:16 ` Lawrence Rust 2008-12-20 8:32 ` Roland HAMON 2008-12-20 10:59 ` Lawrence Rust 2009-01-03 11:20 ` Lawrence Rust
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.