[alsa-devel] ALC892 optical SPDIF not working
Hello,
I have a Gigabyte 890GX-based board with an ALC892 codec. The optical SPDIF output does not work at all (i.e. no red light on the cable), and the kernel prints "ALSA hda_codec.c:407: Too many connections" messages whenever sound is played (analog works, but I need digital).
Below are the contents of /proc/asound/card0/codec#0.
Thanks, Manuel Lauss
Codec: Realtek ALC892 Address: 0 Function Id: 0x1 Vendor Id: 0x10ec0892 Subsystem Id: 0x1458a102 Revision Id: 0x100302 No Modem Function Group found Default PCM: rates [0x5f0]: 32000 44100 48000 88200 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Default Amp-In caps: N/A Default Amp-Out caps: N/A GPIO: io=2, o=0, i=0, unsolicited=1, wake=0 IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out Control: name="Front Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Device: name="ALC892 Analog", type="Audio", device=0 Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0 Amp-Out vals: [0x40 0x40] Converter: stream=0, channel=0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x03 [Audio Output] wcaps 0x41d: Stereo Amp-Out Control: name="Surround Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0 Amp-Out vals: [0x40 0x40] Converter: stream=0, channel=0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x04 [Audio Output] wcaps 0x41d: Stereo Amp-Out Control: name="Center Playback Volume", index=0, device=0 ControlAmp: chs=1, dir=Out, idx=0, ofs=0 Control: name="LFE Playback Volume", index=0, device=0 ControlAmp: chs=2, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0 Amp-Out vals: [0x40 0x40] Converter: stream=0, channel=0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x05 [Audio Output] wcaps 0x41d: Stereo Amp-Out Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0 Amp-Out vals: [0x40 0x40] Converter: stream=0, channel=0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x06 [Audio Output] wcaps 0x611: Stereo Digital Control: name="IEC958 Playback Con Mask", index=0, device=0 Control: name="IEC958 Playback Pro Mask", index=0, device=0 Control: name="IEC958 Playback Default", index=0, device=0 Control: name="IEC958 Playback Switch", index=0, device=0 Control: name="IEC958 Default PCM Playback Switch", index=0, device=0 Device: name="ALC892 Digital", type="SPDIF", device=1 Converter: stream=0, channel=0 Digital: Enabled Digital category: 0x0 PCM: rates [0x5f0]: 32000 44100 48000 88200 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x07 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x08 [Audio Input] wcaps 0x10051b: Stereo Amp-In Control: name="Capture Switch", index=1, device=0 Control: name="Capture Volume", index=1, device=0 Amp-In caps: ofs=0x10, nsteps=0x2e, stepsize=0x03, mute=1 Amp-In vals: [0x90 0x90] Converter: stream=0, channel=0 SDI-Select: 0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 1 0x23 Node 0x09 [Audio Input] wcaps 0x10051b: Stereo Amp-In Control: name="Capture Switch", index=0, device=0 Control: name="Capture Volume", index=0, device=0 Device: name="ALC892 Analog", type="Audio", device=0 Amp-In caps: ofs=0x10, nsteps=0x2e, stepsize=0x03, mute=1 Amp-In vals: [0x9c 0x9c] Converter: stream=0, channel=0 SDI-Select: 0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 1 0x22 Node 0x0a [Audio Input] wcaps 0x100711: Stereo Digital Converter: stream=0, channel=0 SDI-Select: 0 Digital: Digital category: 0x0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 1 0x1f Node 0x0b [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Control: name="Mic Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Control: name="Mic Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Control: name="Front Mic Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=1, ofs=0 Control: name="Front Mic Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=1, ofs=0 Control: name="Line Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Control: name="Line Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=2, ofs=0 Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1 Amp-In vals: [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] Connection: 10 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x14 0x15 0x16 0x17 Node 0x0c [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Control: name="Front Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x02 0x0b Node 0x0d [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Control: name="Surround Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x03 0x0b Node 0x0e [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Control: name="Center Playback Switch", index=0, device=0 ControlAmp: chs=1, dir=In, idx=0, ofs=0 Control: name="LFE Playback Switch", index=0, device=0 ControlAmp: chs=2, dir=In, idx=0, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x00 0x00] Connection: 2 0x04 0x0b Node 0x0f [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x80 0x80] Connection: 2 0x05 0x0b Node 0x10 [Audio Output] wcaps 0x611: Stereo Digital Converter: stream=0, channel=0 Digital: Digital category: 0x0 PCM: rates [0x5f0]: 32000 44100 48000 88200 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x11 [Pin Complex] wcaps 0x400781: Stereo Digital Pincap 0x00000014: OUT Detect Pin Default 0x99430140: [Fixed] SPDIF Out at Int ATAPI Conn = ATAPI, Color = Unknown DefAssociation = 0x4, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x00: Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 1 0x10 Node 0x12 [Pin Complex] wcaps 0x400401: Stereo Pincap 0x00000020: IN Pin Default 0x411111f0: [N/A] Speaker at Ext Rear Conn = 1/8, Color = Black DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x00: Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x13 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x14 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x0000003e: IN OUT HP Detect Trigger Pin Default 0x01014410: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Green DefAssociation = 0x1, Sequence = 0x0 Pin-ctls: 0x40: OUT Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 1 0x0c Node 0x15 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000036: IN OUT Detect Trigger Pin Default 0x01011412: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Black DefAssociation = 0x1, Sequence = 0x2 Pin-ctls: 0x40: OUT Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 1 0x0d Node 0x16 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000036: IN OUT Detect Trigger Pin Default 0x01016411: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Orange DefAssociation = 0x1, Sequence = 0x1 Pin-ctls: 0x40: OUT Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 1 0x0e Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00000036: IN OUT Detect Trigger Pin Default 0x01012414: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Grey DefAssociation = 0x1, Sequence = 0x4 Pin-ctls: 0x40: OUT Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 1 0x0f Node 0x18 [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out Control: name="Mic Boost", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x00003736: IN OUT Detect Trigger Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01a19c50: [Jack] Mic at Ext Rear Conn = 1/8, Color = Pink DefAssociation = 0x5, Sequence = 0x0 Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 Node 0x19 [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out Control: name="Front Mic Boost", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x0000373e: IN OUT HP Detect Trigger Vref caps: HIZ 50 GRD 80 100 Pin Default 0x02a19c60: [Jack] Mic at Ext Front Conn = 1/8, Color = Pink DefAssociation = 0x6, Sequence = 0x0 Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 Node 0x1a [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x00003736: IN OUT Detect Trigger Vref caps: HIZ 50 GRD 80 100 Pin Default 0x0181345f: [Jack] Line In at Ext Rear Conn = 1/8, Color = Blue DefAssociation = 0x5, Sequence = 0xf Pin-ctls: 0x20: IN VREF_HIZ Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 Node 0x1b [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out Control: name="Headphone Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x0000373e: IN OUT HP Detect Trigger Vref caps: HIZ 50 GRD 80 100 Pin Default 0x02214c20: [Jack] HP Out at Ext Front Conn = 1/8, Color = Green DefAssociation = 0x2, Sequence = 0x0 Pin-ctls: 0xc0: OUT HP VREF_HIZ Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 Node 0x1c [Pin Complex] wcaps 0x400481: Stereo Pincap 0x00000024: IN Detect Pin Default 0x593301f0: [N/A] CD at Int ATAPI Conn = ATAPI, Color = Unknown DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x20: IN Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x1d [Pin Complex] wcaps 0x400400: Mono Pincap 0x00000020: IN Pin Default 0x4005e601: [N/A] Line Out at Ext N/A Conn = Optical, Color = White DefAssociation = 0x0, Sequence = 0x1 Pin-ctls: 0x00: Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x1e [Pin Complex] wcaps 0x400781: Stereo Digital Pincap 0x00000014: OUT Detect Pin Default 0x014b6130: [Jack] SPDIF Out at Ext Rear Conn = Comb, Color = Orange DefAssociation = 0x3, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x00: Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 1 0x06 Node 0x1f [Pin Complex] wcaps 0x400681: Stereo Digital Pincap 0x00000024: IN Detect Pin Default 0x01cb7170: [Jack] SPDIF In at Ext Rear Conn = Comb, Color = Yellow DefAssociation = 0x7, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x00: Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x20 [Vendor Defined Widget] wcaps 0xf00040: Mono Processing caps: benign=0, ncoeff=24 Node 0x21 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Control: name="Input Source", index=0, device=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] Connection: 12 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x14 0x15 0x16 0x17 0x0b 0x12 Node 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Control: name="Input Source", index=1, device=0 Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] Connection: 11 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x14 0x15 0x16 0x17 0x0b Node 0x24 [Vendor Defined Widget] wcaps 0xf00000: Mono Node 0x25 [Audio Output] wcaps 0x41d: Stereo Amp-Out Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0 Amp-Out vals: [0x40 0x40] Converter: stream=0, channel=0 PCM: rates [0x560]: 44100 48000 96000 192000 bits [0xe]: 16 20 24 formats [0x1]: PCM Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Node 0x26 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-In vals: [0x00 0x00] [0x80 0x80] Connection: 2 0x25 0x0b -- To unsubscribe from this list: send the line "unsubscribe alsa-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
At Fri, 30 Jul 2010 10:00:13 +0200, Manuel Lauss wrote:
Hello,
I have a Gigabyte 890GX-based board with an ALC892 codec. The optical SPDIF output does not work at all (i.e. no red light on the cable), and the kernel prints "ALSA hda_codec.c:407: Too many connections" messages whenever sound is played (analog works, but I need digital).
Could you try the latest alsa-driver-snapshot? ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
I fixed a few things regarding digital I/O handling of Realtek codecs now, and fixed the too-many-connections bug there, too.
thanks,
Takashi
On Fri, Jul 30, 2010 at 11:13 AM, Takashi Iwai tiwai@suse.de wrote:
At Fri, 30 Jul 2010 10:00:13 +0200, Manuel Lauss wrote:
Hello,
I have a Gigabyte 890GX-based board with an ALC892 codec. The optical SPDIF output does not work at all (i.e. no red light on the cable), and the kernel prints "ALSA hda_codec.c:407: Too many connections" messages whenever sound is played (analog works, but I need digital).
Could you try the latest alsa-driver-snapshot? ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
I fixed a few things regarding digital I/O handling of Realtek codecs now, and fixed the too-many-connections bug there, too.
I pulled from your tree: AC3/DTS passthrough works now, however "normal" audio only works with 48kHz rate.
Thank you! Manuel Lauss
Hi Takashi,
On Fri, Jul 30, 2010 at 12:24 PM, Manuel Lauss manuel.lauss@googlemail.com wrote:
On Fri, Jul 30, 2010 at 11:13 AM, Takashi Iwai tiwai@suse.de wrote:
At Fri, 30 Jul 2010 10:00:13 +0200, Manuel Lauss wrote:
Hello,
I have a Gigabyte 890GX-based board with an ALC892 codec. The optical SPDIF output does not work at all (i.e. no red light on the cable), and the kernel prints "ALSA hda_codec.c:407: Too many connections" messages whenever sound is played (analog works, but I need digital).
Could you try the latest alsa-driver-snapshot? ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
I fixed a few things regarding digital I/O handling of Realtek codecs now, and fixed the too-many-connections bug there, too.
I pulled from your tree: AC3/DTS passthrough works now, however "normal" audio only works with 48kHz rate.
Is there a way to insert an initial playback delay? Under linux, the first 2-2.5 seconds of anything played are just silence; on windows audible playback starts immediately.
Thanks, Manuel Lauss
At Fri, 30 Jul 2010 13:32:40 +0200, Manuel Lauss wrote:
Hi Takashi,
On Fri, Jul 30, 2010 at 12:24 PM, Manuel Lauss manuel.lauss@googlemail.com wrote:
On Fri, Jul 30, 2010 at 11:13 AM, Takashi Iwai tiwai@suse.de wrote:
At Fri, 30 Jul 2010 10:00:13 +0200, Manuel Lauss wrote:
Hello,
I have a Gigabyte 890GX-based board with an ALC892 codec. The optical SPDIF output does not work at all (i.e. no red light on the cable), and the kernel prints "ALSA hda_codec.c:407: Too many connections" messages whenever sound is played (analog works, but I need digital).
Could you try the latest alsa-driver-snapshot? ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
I fixed a few things regarding digital I/O handling of Realtek codecs now, and fixed the too-many-connections bug there, too.
I pulled from your tree: AC3/DTS passthrough works now, however "normal" audio only works with 48kHz rate.
Is there a way to insert an initial playback delay? Under linux, the first 2-2.5 seconds of anything played are just silence; on windows audible playback starts immediately.
It's the time for synchronization your digital receiver takes, I guess. Maybe changing SPDIF status makes it resync, which happens at each opening / closing the stream.
Takashi
On Fri, Jul 30, 2010 at 1:59 PM, Takashi Iwai tiwai@suse.de wrote:
At Fri, 30 Jul 2010 13:32:40 +0200, Manuel Lauss wrote:
Hi Takashi,
On Fri, Jul 30, 2010 at 12:24 PM, Manuel Lauss manuel.lauss@googlemail.com wrote:
On Fri, Jul 30, 2010 at 11:13 AM, Takashi Iwai tiwai@suse.de wrote:
At Fri, 30 Jul 2010 10:00:13 +0200, Manuel Lauss wrote:
Hello,
I have a Gigabyte 890GX-based board with an ALC892 codec. The optical SPDIF output does not work at all (i.e. no red light on the cable), and the kernel prints "ALSA hda_codec.c:407: Too many connections" messages whenever sound is played (analog works, but I need digital).
Could you try the latest alsa-driver-snapshot? ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
I fixed a few things regarding digital I/O handling of Realtek codecs now, and fixed the too-many-connections bug there, too.
I pulled from your tree: AC3/DTS passthrough works now, however "normal" audio only works with 48kHz rate.
Is there a way to insert an initial playback delay? Under linux, the first 2-2.5 seconds of anything played are just silence; on windows audible playback starts immediately.
It's the time for synchronization your digital receiver takes, I guess. Maybe changing SPDIF status makes it resync, which happens at each opening / closing the stream.
Yes, seems so. I've found a workaround in meantime.
Thanks! Manuel Lauss
Am Freitag, den 30.07.2010, 14:03 +0200 schrieb Manuel Lauss:
On Fri, Jul 30, 2010 at 1:59 PM, Takashi Iwai tiwai@suse.de wrote:
At Fri, 30 Jul 2010 13:32:40 +0200, Manuel Lauss wrote:
On Fri, Jul 30, 2010 at 12:24 PM, Manuel Lauss manuel.lauss@googlemail.com wrote:
On Fri, Jul 30, 2010 at 11:13 AM, Takashi Iwai tiwai@suse.de wrote:
At Fri, 30 Jul 2010 10:00:13 +0200, Manuel Lauss wrote:
Hello,
I have a Gigabyte 890GX-based board with an ALC892 codec. The optical SPDIF output does not work at all (i.e. no red light on the cable), and the kernel prints "ALSA hda_codec.c:407: Too many connections" messages whenever sound is played (analog works, but I need digital).
Could you try the latest alsa-driver-snapshot? ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
I fixed a few things regarding digital I/O handling of Realtek codecs now, and fixed the too-many-connections bug there, too.
I pulled from your tree: AC3/DTS passthrough works now, however "normal" audio only works with 48kHz rate.
Is there a way to insert an initial playback delay? Under linux, the first 2-2.5 seconds of anything played are just silence; on windows audible playback starts immediately.
It's the time for synchronization your digital receiver takes, I guess. Maybe changing SPDIF status makes it resync, which happens at each opening / closing the stream.
Yes, seems so. I've found a workaround in meantime.
Could you elaborate on the workaround please, so others having this issue know it.
Thanks,
Paul
Is there a way to insert an initial playback delay? Under linux, the first 2-2.5 seconds of anything played are just silence; on windows audible playback starts immediately.
It's the time for synchronization your digital receiver takes, I guess. Maybe changing SPDIF status makes it resync, which happens at each opening / closing the stream.
Yes, seems so. I've found a workaround in meantime.
Could you elaborate on the workaround please, so others having this issue know it.
My receiver allows to mix analog and digital inputs; with analog mix enabled it syncs immediately.
Manuel
At Sun, 1 Aug 2010 01:32:23 +0200, Manuel Lauss wrote:
Is there a way to insert an initial playback delay? Under linux, the first 2-2.5 seconds of anything played are just silence; on windows audible playback starts immediately.
It's the time for synchronization your digital receiver takes, I guess. Maybe changing SPDIF status makes it resync, which happens at each opening / closing the stream.
Yes, seems so. I've found a workaround in meantime.
Could you elaborate on the workaround please, so others having this issue know it.
My receiver allows to mix analog and digital inputs; with analog mix enabled it syncs immediately.
Just wondering whether the patch below helps?
It's just a proof-of-concept, and it's not safe for multiple streams. If this works, we can move on the improvement of the stream assignment.
thanks,
Takashi
--- diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 4d5abbd..45f2bb3 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1181,38 +1181,30 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, u32 stream_tag, int channel_id, int format) { + u32 oldval; + if (!nid) return;
snd_printdd("hda_codec_setup_stream: " "NID=0x%x, stream=0x%x, channel=%d, format=0x%x\n", nid, stream_tag, channel_id, format); - snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, - (stream_tag << 4) | channel_id); - msleep(1); - snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); + stream_tag = (stream_tag << 4) | channel_id; + oldval = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); + if (stream_tag != oldval) { + snd_hda_codec_write(codec, nid, 0, + AC_VERB_SET_CHANNEL_STREAMID, stream_tag); + } + oldval = snd_hda_codec_read(codec, nid, 0, + AC_VERB_GET_STREAM_FORMAT, 0); + if (format != oldval) { + msleep(1); + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, + format); + } } EXPORT_SYMBOL_HDA(snd_hda_codec_setup_stream);
-/** - * snd_hda_codec_cleanup_stream - clean up the codec for closing - * @codec: the CODEC to clean up - * @nid: the NID to clean up - */ -void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid) -{ - if (!nid) - return; - - snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid); - snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0); -#if 0 /* keep the format */ - msleep(1); - snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0); -#endif -} -EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream); - /* * amp access functions */ diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index a115c0c..61e177d 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -927,7 +927,10 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec); void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, u32 stream_tag, int channel_id, int format); -void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid); +/*void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid);*/ +static inline void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid) {} + + unsigned int snd_hda_calc_stream_format(unsigned int rate, unsigned int channels, unsigned int format,
At Mon, 02 Aug 2010 10:02:48 +0200, I wrote:
At Sun, 1 Aug 2010 01:32:23 +0200, Manuel Lauss wrote:
Is there a way to insert an initial playback delay? Under linux, the first 2-2.5 seconds of anything played are just silence; on windows audible playback starts immediately.
It's the time for synchronization your digital receiver takes, I guess. Maybe changing SPDIF status makes it resync, which happens at each opening / closing the stream.
Yes, seems so. I've found a workaround in meantime.
Could you elaborate on the workaround please, so others having this issue know it.
My receiver allows to mix analog and digital inputs; with analog mix enabled it syncs immediately.
Just wondering whether the patch below helps?
It's just a proof-of-concept, and it's not safe for multiple streams. If this works, we can move on the improvement of the stream assignment.
... and the below is the patch. If the previous patch worked, try this instead of the previous one.
thanks,
Takashi
--- diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 4d5abbd..d510359 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -971,6 +971,36 @@ static void restore_init_pincfgs(struct hda_codec *codec) }
/* + * audio-converter setup caches + */ +struct hda_cvt_setup { + hda_nid_t nid; + u8 stream_tag; + u8 channel_id; + u16 format_id; + u8 active; + u8 dirty; +}; + +/* get or create a cache entry for the given audio converter NID */ +static struct hda_cvt_setup * +get_hda_cvt_setup(struct hda_codec *codec, hda_nid_t nid) +{ + struct hda_cvt_setup *p; + int i; + + for (i = 0; i < codec->cvt_setups.used; i++) { + p = snd_array_elem(&codec->cvt_setups, i); + if (p->nid == nid) + return p; + } + p = snd_array_new(&codec->cvt_setups); + if (p) + p->nid = nid; + return p; +} + +/* * codec destructor */ static void snd_hda_codec_free(struct hda_codec *codec) @@ -1038,12 +1068,14 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, codec->addr = codec_addr; mutex_init(&codec->spdif_mutex); mutex_init(&codec->control_mutex); + mutex_init(&codec->prepare_mutex); init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32); snd_array_init(&codec->nids, sizeof(struct hda_nid_item), 32); snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); + snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8); if (codec->bus->modelname) { codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL); if (!codec->modelname) { @@ -1181,16 +1213,50 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, u32 stream_tag, int channel_id, int format) { + struct hda_cvt_setup *p; + unsigned int oldval, newval; + int i; + if (!nid) return;
snd_printdd("hda_codec_setup_stream: " "NID=0x%x, stream=0x%x, channel=%d, format=0x%x\n", nid, stream_tag, channel_id, format); - snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, - (stream_tag << 4) | channel_id); - msleep(1); - snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); + p = get_hda_cvt_setup(codec, nid); + if (!p) + return; + /* update the stream-id if changed */ + if (p->stream_tag != stream_tag || p->channel_id != channel_id) { + oldval = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); + newval = (stream_tag << 4) | channel_id; + if (oldval != newval) + snd_hda_codec_write(codec, nid, 0, + AC_VERB_SET_CHANNEL_STREAMID, + newval); + p->stream_tag = stream_tag; + p->channel_id = channel_id; + } + /* update the format-id if changed */ + if (p->format_id != format) { + oldval = snd_hda_codec_read(codec, nid, 0, + AC_VERB_GET_STREAM_FORMAT, 0); + if (oldval != format) { + msleep(1); + snd_hda_codec_write(codec, nid, 0, + AC_VERB_SET_STREAM_FORMAT, + format); + } + p->format_id = format; + } + p->active = 1; + p->dirty = 0; + + /* make other inactive cvts with the same stream-tag dirty */ + for (i = 0; i < codec->cvt_setups.used; i++) { + if (!p->active && p->stream_tag == stream_tag) + p->dirty = 1; + } } EXPORT_SYMBOL_HDA(snd_hda_codec_setup_stream);
@@ -1201,17 +1267,54 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_setup_stream); */ void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid) { + struct hda_cvt_setup *p; + if (!nid) return;
snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid); + /* here we just clear the active flag; actual clean-ups will be done + * in purify_inactive_streams() + */ + p = get_hda_cvt_setup(codec, nid); + if (p) + p->active = 0; +} +EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream); + +static void really_cleanup_stream(struct hda_codec *codec, + struct hda_cvt_setup *q) +{ + hda_nid_t nid = q->nid; snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0); -#if 0 /* keep the format */ - msleep(1); snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0); -#endif + memset(q, 0, sizeof(*q)); + q->nid = nid; +} + +/* clean up the all conflicting obsolete streams */ +static void purify_inactive_streams(struct hda_codec *codec) +{ + int i; + + for (i = 0; i < codec->cvt_setups.used; i++) { + struct hda_cvt_setup *p = snd_array_elem(&codec->cvt_setups, i); + if (p->dirty) + really_cleanup_stream(codec, p); + } +} + +/* clean up all streams; called from suspend */ +static void hda_cleanup_all_streams(struct hda_codec *codec) +{ + int i; + + for (i = 0; i < codec->cvt_setups.used; i++) { + struct hda_cvt_setup *p = snd_array_elem(&codec->cvt_setups, i); + if (p->stream_tag) + really_cleanup_stream(codec, p); + } } -EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream);
/* * amp access functions @@ -2928,6 +3031,7 @@ static void hda_call_codec_suspend(struct hda_codec *codec) { if (codec->patch_ops.suspend) codec->patch_ops.suspend(codec, PMSG_SUSPEND); + hda_cleanup_all_streams(codec); hda_set_power_state(codec, codec->afg ? codec->afg : codec->mfg, AC_PWRST_D3); @@ -3368,6 +3472,35 @@ static int set_pcm_default_values(struct hda_codec *codec, return 0; }
+/* + * codec prepare/cleanup entries + */ +int snd_hda_codec_prepare(struct hda_codec *codec, + struct hda_pcm_stream *hinfo, + unsigned int stream, + unsigned int format, + struct snd_pcm_substream *substream) +{ + int ret; + mutex_lock(&codec->prepare_mutex); + ret = hinfo->ops.prepare(hinfo, codec, stream, format, substream); + if (ret >= 0) + purify_inactive_streams(codec); + mutex_unlock(&codec->prepare_mutex); + return ret; +} +EXPORT_SYMBOL_HDA(snd_hda_codec_prepare); + +void snd_hda_codec_cleanup(struct hda_codec *codec, + struct hda_pcm_stream *hinfo, + struct snd_pcm_substream *substream) +{ + mutex_lock(&codec->prepare_mutex); + hinfo->ops.cleanup(hinfo, codec, substream); + mutex_unlock(&codec->prepare_mutex); +} +EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup); + /* global */ const char *snd_hda_pcm_type_name[HDA_PCM_NTYPES] = { "Audio", "SPDIF", "HDMI", "Modem" diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index a115c0c..b4242f0 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -802,12 +802,14 @@ struct hda_codec {
struct mutex spdif_mutex; struct mutex control_mutex; + struct mutex prepare_mutex; unsigned int spdif_status; /* IEC958 status bits */ unsigned short spdif_ctls; /* SPDIF control bits */ unsigned int spdif_in_enable; /* SPDIF input enable? */ hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ struct snd_array init_pins; /* initial (BIOS) pin configurations */ struct snd_array driver_pins; /* pin configs set by codec parser */ + struct snd_array cvt_setups; /* audio convert setups */
#ifdef CONFIG_SND_HDA_HWDEP struct snd_hwdep *hwdep; /* assigned hwdep device */ @@ -924,6 +926,16 @@ int snd_hda_codec_build_controls(struct hda_codec *codec); */ int snd_hda_build_pcms(struct hda_bus *bus); int snd_hda_codec_build_pcms(struct hda_codec *codec); + +int snd_hda_codec_prepare(struct hda_codec *codec, + struct hda_pcm_stream *hinfo, + unsigned int stream, + unsigned int format, + struct snd_pcm_substream *substream); +void snd_hda_codec_cleanup(struct hda_codec *codec, + struct hda_pcm_stream *hinfo, + struct snd_pcm_substream *substream); + void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, u32 stream_tag, int channel_id, int format); diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 1df25cf..3584301 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1634,7 +1634,7 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream) azx_dev->period_bytes = 0; azx_dev->format_val = 0;
- hinfo->ops.cleanup(hinfo, apcm->codec, substream); + snd_hda_codec_cleanup(apcm->codec, hinfo, substream);
return snd_pcm_lib_free_pages(substream); } @@ -1687,8 +1687,8 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) else azx_dev->fifo_size = 0;
- return hinfo->ops.prepare(hinfo, apcm->codec, azx_dev->stream_tag, - azx_dev->format_val, substream); + return snd_hda_codec_prepare(apcm->codec, hinfo, azx_dev->stream_tag, + azx_dev->format_val, substream); }
static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
On Mon, Aug 02, 2010 at 06:03:32PM +0200, Takashi Iwai wrote:
At Mon, 02 Aug 2010 10:02:48 +0200, I wrote:
At Sun, 1 Aug 2010 01:32:23 +0200, Manuel Lauss wrote:
> Is there a way to insert an initial playback delay? Under linux, the > first 2-2.5 seconds > of anything played are just silence; on windows audible playback > starts immediately.
It's the time for synchronization your digital receiver takes, I guess. Maybe changing SPDIF status makes it resync, which happens at each opening / closing the stream.
Yes, seems so. I've found a workaround in meantime.
Could you elaborate on the workaround please, so others having this issue know it.
My receiver allows to mix analog and digital inputs; with analog mix enabled it syncs immediately.
Just wondering whether the patch below helps?
It's just a proof-of-concept, and it's not safe for multiple streams. If this works, we can move on the improvement of the stream assignment.
... and the below is the patch. If the previous patch worked, try this instead of the previous one.
Tested with mplayer. The initial 2-2.5sec silence is still there (on every invocation of mplayer), but seeking now works as it should (previously there was 2 sec silence too). Disabling codec pm doesn't help.
Manuel Lauss
At Thu, 5 Aug 2010 20:52:28 +0200, Manuel Lauss wrote:
On Mon, Aug 02, 2010 at 06:03:32PM +0200, Takashi Iwai wrote:
At Mon, 02 Aug 2010 10:02:48 +0200, I wrote:
At Sun, 1 Aug 2010 01:32:23 +0200, Manuel Lauss wrote:
>> Is there a way to insert an initial playback delay? Under linux, the >> first 2-2.5 seconds >> of anything played are just silence; on windows audible playback >> starts immediately. > > It's the time for synchronization your digital receiver takes, I guess. > Maybe changing SPDIF status makes it resync, which happens at each > opening / closing the stream.
Yes, seems so. I've found a workaround in meantime.
Could you elaborate on the workaround please, so others having this issue know it.
My receiver allows to mix analog and digital inputs; with analog mix enabled it syncs immediately.
Just wondering whether the patch below helps?
It's just a proof-of-concept, and it's not safe for multiple streams. If this works, we can move on the improvement of the stream assignment.
... and the below is the patch. If the previous patch worked, try this instead of the previous one.
Tested with mplayer. The initial 2-2.5sec silence is still there (on every invocation of mplayer), but seeking now works as it should (previously there was 2 sec silence too). Disabling codec pm doesn't help.
OK, it's a slight improvement. Now the question is why it still happens at each invocation of mplayer. Assuming that it's no power-save, one possible explanation is the call of azx_stream_reset() in prepare. But, then this should happen at each seek, too.
Could you put some printk's and check whether AC_VERB_SET_CHANNEL_STREAMID and/or AC_VERB_GET_STREAM_FORMAT verbs are executed at each time or properly cached?
thanks,
Takashi
On Thu, Aug 05, 2010 at 10:11:18PM +0200, Takashi Iwai wrote:
At Thu, 5 Aug 2010 20:52:28 +0200, Manuel Lauss wrote:
On Mon, Aug 02, 2010 at 06:03:32PM +0200, Takashi Iwai wrote:
At Mon, 02 Aug 2010 10:02:48 +0200, I wrote:
At Sun, 1 Aug 2010 01:32:23 +0200, Manuel Lauss wrote:
> >> Is there a way to insert an initial playback delay? Under linux, the > >> first 2-2.5 seconds > >> of anything played are just silence; on windows audible playback > >> starts immediately. > > > > It's the time for synchronization your digital receiver takes, I guess. > > Maybe changing SPDIF status makes it resync, which happens at each > > opening / closing the stream. > > Yes, seems so. I've found a workaround in meantime.
Could you elaborate on the workaround please, so others having this issue know it.
My receiver allows to mix analog and digital inputs; with analog mix enabled it syncs immediately.
Just wondering whether the patch below helps?
It's just a proof-of-concept, and it's not safe for multiple streams. If this works, we can move on the improvement of the stream assignment.
... and the below is the patch. If the previous patch worked, try this instead of the previous one.
Tested with mplayer. The initial 2-2.5sec silence is still there (on every invocation of mplayer), but seeking now works as it should (previously there was 2 sec silence too). Disabling codec pm doesn't help.
OK, it's a slight improvement. Now the question is why it still happens at each invocation of mplayer. Assuming that it's no power-save, one possible explanation is the call of azx_stream_reset() in prepare. But, then this should happen at each seek, too.
Could you put some printk's and check whether AC_VERB_SET_CHANNEL_STREAMID and/or AC_VERB_GET_STREAM_FORMAT verbs are executed at each time or properly cached?
Something new in the dmesg:
hda_codec: ALC892: BIOS auto-probing. ALSA hda_codec.c:337: hda_codec: connection list not available for 0x1f ALSA device list: #0: HDA ATI SB at 0xfe024000 irq 16
I added a few printks (see patch below). This is the output generated at every invocation of mplayer:
S1: p->stream_tag 00000000 stream_tag 00000005 p->channel_id 0 channel_id 0 S2: oldval 0 newval 50 S3: p->format_id 0 format 49 S4: oldval 0 newval 50 S1: p->stream_tag 00000000 stream_tag 00000005 p->channel_id 0 channel_id 0 S2: oldval 0 newval 50 S3: p->format_id 0 format 49 S4: oldval 0 newval 50 S1: p->stream_tag 00000000 stream_tag 00000005 p->channel_id 0 channel_id 0 S2: oldval 0 newval 50 S3: p->format_id 0 format 49 S4: oldval 0 newval 50 S1: p->stream_tag 00000000 stream_tag 00000005 p->channel_id 0 channel_id 0 S2: oldval 0 newval 50 S3: p->format_id 0 format 49 S4: oldval 0 newval 50 S1: p->stream_tag 00000000 stream_tag 00000005 p->channel_id 0 channel_id 0 S2: oldval 0 newval 50 S3: p->format_id 0 format 49 S4: oldval 0 newval 50
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index d510359..d6036c6 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1227,9 +1227,13 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, if (!p) return; /* update the stream-id if changed */ + printk(KERN_ERR "S1: p->stream_tag %08lx stream_tag %08lx p->channel_id %d channel_id %d\n", + p->stream_tag, stream_tag, p->channel_id, channel_id); + if (p->stream_tag != stream_tag || p->channel_id != channel_id) { oldval = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); newval = (stream_tag << 4) | channel_id; + printk(KERN_ERR "S2: oldval %x newval %x\n", oldval, newval); if (oldval != newval) snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, @@ -1238,9 +1242,11 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, p->channel_id = channel_id; } /* update the format-id if changed */ + printk(KERN_ERR "S3: p->format_id %d format %d\n", p->format_id, format); if (p->format_id != format) { oldval = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_STREAM_FORMAT, 0); + printk(KERN_ERR "S4: oldval %x newval %x\n", oldval, newval); if (oldval != format) { msleep(1); snd_hda_codec_write(codec, nid, 0,
Thanks! Manuel Lauss
At Sat, 7 Aug 2010 10:11:16 +0200, Manuel Lauss wrote:
On Thu, Aug 05, 2010 at 10:11:18PM +0200, Takashi Iwai wrote:
At Thu, 5 Aug 2010 20:52:28 +0200, Manuel Lauss wrote:
On Mon, Aug 02, 2010 at 06:03:32PM +0200, Takashi Iwai wrote:
At Mon, 02 Aug 2010 10:02:48 +0200, I wrote:
At Sun, 1 Aug 2010 01:32:23 +0200, Manuel Lauss wrote:
> > >> Is there a way to insert an initial playback delay? Under linux, the > > >> first 2-2.5 seconds > > >> of anything played are just silence; on windows audible playback > > >> starts immediately. > > > > > > It's the time for synchronization your digital receiver takes, I guess. > > > Maybe changing SPDIF status makes it resync, which happens at each > > > opening / closing the stream. > > > > Yes, seems so. I've found a workaround in meantime. > > Could you elaborate on the workaround please, so others having this > issue know it.
My receiver allows to mix analog and digital inputs; with analog mix enabled it syncs immediately.
Just wondering whether the patch below helps?
It's just a proof-of-concept, and it's not safe for multiple streams. If this works, we can move on the improvement of the stream assignment.
... and the below is the patch. If the previous patch worked, try this instead of the previous one.
Tested with mplayer. The initial 2-2.5sec silence is still there (on every invocation of mplayer), but seeking now works as it should (previously there was 2 sec silence too). Disabling codec pm doesn't help.
OK, it's a slight improvement. Now the question is why it still happens at each invocation of mplayer. Assuming that it's no power-save, one possible explanation is the call of azx_stream_reset() in prepare. But, then this should happen at each seek, too.
Could you put some printk's and check whether AC_VERB_SET_CHANNEL_STREAMID and/or AC_VERB_GET_STREAM_FORMAT verbs are executed at each time or properly cached?
Something new in the dmesg:
hda_codec: ALC892: BIOS auto-probing. ALSA hda_codec.c:337: hda_codec: connection list not available for 0x1f ALSA device list: #0: HDA ATI SB at 0xfe024000 irq 16
I added a few printks (see patch below). This is the output generated at every invocation of mplayer:
S1: p->stream_tag 00000000 stream_tag 00000005 p->channel_id 0 channel_id 0 S2: oldval 0 newval 50 S3: p->format_id 0 format 49 S4: oldval 0 newval 50 S1: p->stream_tag 00000000 stream_tag 00000005 p->channel_id 0 channel_id 0 S2: oldval 0 newval 50 S3: p->format_id 0 format 49 S4: oldval 0 newval 50 S1: p->stream_tag 00000000 stream_tag 00000005 p->channel_id 0 channel_id 0 S2: oldval 0 newval 50 S3: p->format_id 0 format 49 S4: oldval 0 newval 50 S1: p->stream_tag 00000000 stream_tag 00000005 p->channel_id 0 channel_id 0 S2: oldval 0 newval 50 S3: p->format_id 0 format 49 S4: oldval 0 newval 50 S1: p->stream_tag 00000000 stream_tag 00000005 p->channel_id 0 channel_id 0 S2: oldval 0 newval 50 S3: p->format_id 0 format 49 S4: oldval 0 newval 50
There was one line missing in my previous patch, which was fixed in the sound git tree now. But it's irrelevant with this reset issue, and I can't observe the behavior with analog outputs on my machine unless power-saving is set.
Did you disable power-saving? On many machines, the HD-audio driver is powered down after one or two seconds of the PCM close. Then the driver must reset the stream/format tags at the next open.
Takashi
participants (4)
-
Manuel Lauss
-
Manuel Lauss
-
Paul Menzel
-
Takashi Iwai