[alsa-devel] Bug in sound-unstable-2.6 ice1724
I have: 01:0a.0 Multimedia audio controller: VIA Technologies Inc. VT1720/24 [Envy24PT/HT] PCI Multi-Channel Audio Controller (rev 01) Subsystem: TERRATEC Electronic GmbH PHASE 22 Flags: bus master, medium devsel, latency 64, IRQ 16 I/O ports at c880 [size=32] I/O ports at c800 [size=128] Capabilities: [80] Power Management version 1 Kernel driver in use: ICE1724 Kernel modules: snd-ice1724 I do this: mplayer -ao alsa:device=hw=1.0 -srate 44100 -format s32le get_video Before the song ends, last sample loops for about 20-30 times, and then mplayer quits with error: alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
This doesn't happen on sound-2.6 and doesn't happen on sound-unstable-2.6 with E-mu 1212m.
At Sun, 19 Oct 2008 11:36:35 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
I have: 01:0a.0 Multimedia audio controller: VIA Technologies Inc. VT1720/24 [Envy24PT/HT] PCI Multi-Channel Audio Controller (rev 01) Subsystem: TERRATEC Electronic GmbH PHASE 22 Flags: bus master, medium devsel, latency 64, IRQ 16 I/O ports at c880 [size=32] I/O ports at c800 [size=128] Capabilities: [80] Power Management version 1 Kernel driver in use: ICE1724 Kernel modules: snd-ice1724 I do this: mplayer -ao alsa:device=hw=1.0 -srate 44100 -format s32le get_video Before the song ends, last sample loops for about 20-30 times, and then mplayer quits with error: alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
This doesn't happen on sound-2.6 and doesn't happen on sound-unstable-2.6 with E-mu 1212m.
A suspicious commit is the one in topic/test branch,
commit 442dac7e02a835944bd4d6e429d0b4a2446e0204 Author: Takashi Iwai tiwai@suse.de Date: Tue Aug 12 13:39:02 2008 +0200
ALSA: Allow drain ioctl for non-blocking mode
Could you try to revert this commit?
thanks,
Takashi
No, that didn't fix it. :-(
vedran@kalopsia:~/Media$ mplayer -ao alsa:device=hw=1.0 -srate 22050 -format s32le get_video MPlayer 1.0rc2-4.3.1-DFSG-free (C) 2000-2007 MPlayer Team CPU: AMD Athlon(tm) Dual Core Processor 4450e (Family: 15, Model: 107, Stepping: 2) CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1 Compiled with runtime CPU detection. mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control.
Playing get_video. libavformat file format detected. [lavf] Video stream found, -vid 0 [lavf] Audio stream found, -aid 1 VIDEO: [FLV1] 320x240 0bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s) ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffflv] vfm: ffmpeg (FFmpeg Flash video) ========================================================================== ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 22050 Hz, 2 ch, s16le, 8.0 kbit/1.13% (ratio: 1000->88200) Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== AO: [alsa] 22050Hz 2ch s32le (4 bytes per sample) Starting playback... VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12) VDec: using Planar YV12 as output csp (no 0) Movie-Aspect is undefined - no prescaling applied. VO: [xv] 320x240 => 320x240 Planar YV12 A: 240.8 V: 245.3 A-V: -4.502 ct: -4.382 3350/3350 0% 0% 0.4% 0 0 [AO_ALSA] alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
Exiting... (End of file)
2008/10/20 Takashi Iwai tiwai@suse.de:
At Sun, 19 Oct 2008 11:36:35 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
I have: 01:0a.0 Multimedia audio controller: VIA Technologies Inc. VT1720/24 [Envy24PT/HT] PCI Multi-Channel Audio Controller (rev 01) Subsystem: TERRATEC Electronic GmbH PHASE 22 Flags: bus master, medium devsel, latency 64, IRQ 16 I/O ports at c880 [size=32] I/O ports at c800 [size=128] Capabilities: [80] Power Management version 1 Kernel driver in use: ICE1724 Kernel modules: snd-ice1724 I do this: mplayer -ao alsa:device=hw=1.0 -srate 44100 -format s32le get_video Before the song ends, last sample loops for about 20-30 times, and then mplayer quits with error: alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
This doesn't happen on sound-2.6 and doesn't happen on sound-unstable-2.6 with E-mu 1212m.
A suspicious commit is the one in topic/test branch,
commit 442dac7e02a835944bd4d6e429d0b4a2446e0204 Author: Takashi Iwai tiwai@suse.de Date: Tue Aug 12 13:39:02 2008 +0200
ALSA: Allow drain ioctl for non-blocking mode
Could you try to revert this commit?
thanks,
Takashi
At Tue, 21 Oct 2008 10:49:18 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
No, that didn't fix it. :-(
vedran@kalopsia:~/Media$ mplayer -ao alsa:device=hw=1.0 -srate 22050 -format s32le get_video MPlayer 1.0rc2-4.3.1-DFSG-free (C) 2000-2007 MPlayer Team CPU: AMD Athlon(tm) Dual Core Processor 4450e (Family: 15, Model: 107, Stepping: 2) CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1 Compiled with runtime CPU detection. mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control.
Playing get_video. libavformat file format detected. [lavf] Video stream found, -vid 0 [lavf] Audio stream found, -aid 1 VIDEO: [FLV1] 320x240 0bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s) ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffflv] vfm: ffmpeg (FFmpeg Flash video) ========================================================================== ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 22050 Hz, 2 ch, s16le, 8.0 kbit/1.13% (ratio: 1000->88200) Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== AO: [alsa] 22050Hz 2ch s32le (4 bytes per sample) Starting playback... VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12) VDec: using Planar YV12 as output csp (no 0) Movie-Aspect is undefined - no prescaling applied. VO: [xv] 320x240 => 320x240 Planar YV12 A: 240.8 V: 245.3 A-V: -4.502 ct: -4.382 3350/3350 0% 0% 0.4% 0 0 [AO_ALSA] alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
Did you build with CONFIG_SND_DEBUG=y? I guess you get a kernel error message like "playback drain error (DMA or IRQ..."
If so, a relevant patch is 1083206ff44af4baa03573b4a6bac430d9d70404, ALSA: ice1724 - Fix TX IRQ lockup
Try to revert it.
thanks,
Takashi
Exiting... (End of file)
2008/10/20 Takashi Iwai tiwai@suse.de:
At Sun, 19 Oct 2008 11:36:35 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
I have: 01:0a.0 Multimedia audio controller: VIA Technologies Inc. VT1720/24 [Envy24PT/HT] PCI Multi-Channel Audio Controller (rev 01) Subsystem: TERRATEC Electronic GmbH PHASE 22 Flags: bus master, medium devsel, latency 64, IRQ 16 I/O ports at c880 [size=32] I/O ports at c800 [size=128] Capabilities: [80] Power Management version 1 Kernel driver in use: ICE1724 Kernel modules: snd-ice1724 I do this: mplayer -ao alsa:device=hw=1.0 -srate 44100 -format s32le get_video Before the song ends, last sample loops for about 20-30 times, and then mplayer quits with error: alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
This doesn't happen on sound-2.6 and doesn't happen on sound-unstable-2.6 with E-mu 1212m.
A suspicious commit is the one in topic/test branch,
commit 442dac7e02a835944bd4d6e429d0b4a2446e0204 Author: Takashi Iwai tiwai@suse.de Date: Tue Aug 12 13:39:02 2008 +0200
ALSA: Allow drain ioctl for non-blocking mode
Could you try to revert this commit?
thanks,
Takashi
-- Vedran Miletić
Yeap, that one does it. No need to revert it fully, though. I just uncommented the unsigned char mask line and removed that #if 0 and #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
2008/10/21 Takashi Iwai tiwai@suse.de:
At Tue, 21 Oct 2008 10:49:18 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
No, that didn't fix it. :-(
vedran@kalopsia:~/Media$ mplayer -ao alsa:device=hw=1.0 -srate 22050 -format s32le get_video MPlayer 1.0rc2-4.3.1-DFSG-free (C) 2000-2007 MPlayer Team CPU: AMD Athlon(tm) Dual Core Processor 4450e (Family: 15, Model: 107, Stepping: 2) CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1 Compiled with runtime CPU detection. mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control.
Playing get_video. libavformat file format detected. [lavf] Video stream found, -vid 0 [lavf] Audio stream found, -aid 1 VIDEO: [FLV1] 320x240 0bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s) ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffflv] vfm: ffmpeg (FFmpeg Flash video) ========================================================================== ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 22050 Hz, 2 ch, s16le, 8.0 kbit/1.13% (ratio: 1000->88200) Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== AO: [alsa] 22050Hz 2ch s32le (4 bytes per sample) Starting playback... VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12) VDec: using Planar YV12 as output csp (no 0) Movie-Aspect is undefined - no prescaling applied. VO: [xv] 320x240 => 320x240 Planar YV12 A: 240.8 V: 245.3 A-V: -4.502 ct: -4.382 3350/3350 0% 0% 0.4% 0 0 [AO_ALSA] alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
Did you build with CONFIG_SND_DEBUG=y? I guess you get a kernel error message like "playback drain error (DMA or IRQ..."
If so, a relevant patch is 1083206ff44af4baa03573b4a6bac430d9d70404, ALSA: ice1724 - Fix TX IRQ lockup
Try to revert it.
thanks,
Takashi
Exiting... (End of file)
2008/10/20 Takashi Iwai tiwai@suse.de:
At Sun, 19 Oct 2008 11:36:35 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
I have: 01:0a.0 Multimedia audio controller: VIA Technologies Inc. VT1720/24 [Envy24PT/HT] PCI Multi-Channel Audio Controller (rev 01) Subsystem: TERRATEC Electronic GmbH PHASE 22 Flags: bus master, medium devsel, latency 64, IRQ 16 I/O ports at c880 [size=32] I/O ports at c800 [size=128] Capabilities: [80] Power Management version 1 Kernel driver in use: ICE1724 Kernel modules: snd-ice1724 I do this: mplayer -ao alsa:device=hw=1.0 -srate 44100 -format s32le get_video Before the song ends, last sample loops for about 20-30 times, and then mplayer quits with error: alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
This doesn't happen on sound-2.6 and doesn't happen on sound-unstable-2.6 with E-mu 1212m.
A suspicious commit is the one in topic/test branch,
commit 442dac7e02a835944bd4d6e429d0b4a2446e0204 Author: Takashi Iwai tiwai@suse.de Date: Tue Aug 12 13:39:02 2008 +0200
ALSA: Allow drain ioctl for non-blocking mode
Could you try to revert this commit?
thanks,
Takashi
-- Vedran Miletić
At Sun, 26 Oct 2008 17:31:02 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Yeap, that one does it. No need to revert it fully, though. I just uncommented the unsigned char mask line and removed that #if 0 and #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
Well, before doing that, I'd like to understand the problem more.
If the problem is about the initial IRQ mask value, setting 0 should work as well. Could you change the code just to do like below, and check whether it works? outb(0, ICEREG1724(ice, IRQMASK));
thanks,
Takashi
2008/10/21 Takashi Iwai tiwai@suse.de:
At Tue, 21 Oct 2008 10:49:18 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
No, that didn't fix it. :-(
vedran@kalopsia:~/Media$ mplayer -ao alsa:device=hw=1.0 -srate 22050 -format s32le get_video MPlayer 1.0rc2-4.3.1-DFSG-free (C) 2000-2007 MPlayer Team CPU: AMD Athlon(tm) Dual Core Processor 4450e (Family: 15, Model: 107, Stepping: 2) CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1 Compiled with runtime CPU detection. mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control.
Playing get_video. libavformat file format detected. [lavf] Video stream found, -vid 0 [lavf] Audio stream found, -aid 1 VIDEO: [FLV1] 320x240 0bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s) ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffflv] vfm: ffmpeg (FFmpeg Flash video) ========================================================================== ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 22050 Hz, 2 ch, s16le, 8.0 kbit/1.13% (ratio: 1000->88200) Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== AO: [alsa] 22050Hz 2ch s32le (4 bytes per sample) Starting playback... VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12) VDec: using Planar YV12 as output csp (no 0) Movie-Aspect is undefined - no prescaling applied. VO: [xv] 320x240 => 320x240 Planar YV12 A: 240.8 V: 245.3 A-V: -4.502 ct: -4.382 3350/3350 0% 0% 0.4% 0 0 [AO_ALSA] alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
Did you build with CONFIG_SND_DEBUG=y? I guess you get a kernel error message like "playback drain error (DMA or IRQ..."
If so, a relevant patch is 1083206ff44af4baa03573b4a6bac430d9d70404, ALSA: ice1724 - Fix TX IRQ lockup
Try to revert it.
thanks,
Takashi
Exiting... (End of file)
2008/10/20 Takashi Iwai tiwai@suse.de:
At Sun, 19 Oct 2008 11:36:35 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
I have: 01:0a.0 Multimedia audio controller: VIA Technologies Inc. VT1720/24 [Envy24PT/HT] PCI Multi-Channel Audio Controller (rev 01) Subsystem: TERRATEC Electronic GmbH PHASE 22 Flags: bus master, medium devsel, latency 64, IRQ 16 I/O ports at c880 [size=32] I/O ports at c800 [size=128] Capabilities: [80] Power Management version 1 Kernel driver in use: ICE1724 Kernel modules: snd-ice1724 I do this: mplayer -ao alsa:device=hw=1.0 -srate 44100 -format s32le get_video Before the song ends, last sample loops for about 20-30 times, and then mplayer quits with error: alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
This doesn't happen on sound-2.6 and doesn't happen on sound-unstable-2.6 with E-mu 1212m.
A suspicious commit is the one in topic/test branch,
commit 442dac7e02a835944bd4d6e429d0b4a2446e0204 Author: Takashi Iwai tiwai@suse.de Date: Tue Aug 12 13:39:02 2008 +0200
ALSA: Allow drain ioctl for non-blocking mode
Could you try to revert this commit?
thanks,
Takashi
-- Vedran Miletić
-- Vedran Miletić
Yes, it works. I replaced mask with 0 in that line, and it works exactly the same. I didn't comment or uncomment anything.
Is there some more testing needed?
BTW, can you explain in short what is the issue here? I would like to learn something along the way.
2008/10/26 Takashi Iwai tiwai@suse.de:
At Sun, 26 Oct 2008 17:31:02 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Yeap, that one does it. No need to revert it fully, though. I just uncommented the unsigned char mask line and removed that #if 0 and #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
Well, before doing that, I'd like to understand the problem more.
If the problem is about the initial IRQ mask value, setting 0 should work as well. Could you change the code just to do like below, and check whether it works? outb(0, ICEREG1724(ice, IRQMASK));
thanks,
Takashi
2008/10/21 Takashi Iwai tiwai@suse.de:
At Tue, 21 Oct 2008 10:49:18 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
No, that didn't fix it. :-(
vedran@kalopsia:~/Media$ mplayer -ao alsa:device=hw=1.0 -srate 22050 -format s32le get_video MPlayer 1.0rc2-4.3.1-DFSG-free (C) 2000-2007 MPlayer Team CPU: AMD Athlon(tm) Dual Core Processor 4450e (Family: 15, Model: 107, Stepping: 2) CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1 Compiled with runtime CPU detection. mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control.
Playing get_video. libavformat file format detected. [lavf] Video stream found, -vid 0 [lavf] Audio stream found, -aid 1 VIDEO: [FLV1] 320x240 0bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s) ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffflv] vfm: ffmpeg (FFmpeg Flash video) ========================================================================== ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 22050 Hz, 2 ch, s16le, 8.0 kbit/1.13% (ratio: 1000->88200) Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== AO: [alsa] 22050Hz 2ch s32le (4 bytes per sample) Starting playback... VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12) VDec: using Planar YV12 as output csp (no 0) Movie-Aspect is undefined - no prescaling applied. VO: [xv] 320x240 => 320x240 Planar YV12 A: 240.8 V: 245.3 A-V: -4.502 ct: -4.382 3350/3350 0% 0% 0.4% 0 0 [AO_ALSA] alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
Did you build with CONFIG_SND_DEBUG=y? I guess you get a kernel error message like "playback drain error (DMA or IRQ..."
If so, a relevant patch is 1083206ff44af4baa03573b4a6bac430d9d70404, ALSA: ice1724 - Fix TX IRQ lockup
Try to revert it.
thanks,
Takashi
Exiting... (End of file)
2008/10/20 Takashi Iwai tiwai@suse.de:
At Sun, 19 Oct 2008 11:36:35 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
I have: 01:0a.0 Multimedia audio controller: VIA Technologies Inc. VT1720/24 [Envy24PT/HT] PCI Multi-Channel Audio Controller (rev 01) Subsystem: TERRATEC Electronic GmbH PHASE 22 Flags: bus master, medium devsel, latency 64, IRQ 16 I/O ports at c880 [size=32] I/O ports at c800 [size=128] Capabilities: [80] Power Management version 1 Kernel driver in use: ICE1724 Kernel modules: snd-ice1724 I do this: mplayer -ao alsa:device=hw=1.0 -srate 44100 -format s32le get_video Before the song ends, last sample loops for about 20-30 times, and then mplayer quits with error: alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
This doesn't happen on sound-2.6 and doesn't happen on sound-unstable-2.6 with E-mu 1212m.
A suspicious commit is the one in topic/test branch,
commit 442dac7e02a835944bd4d6e429d0b4a2446e0204 Author: Takashi Iwai tiwai@suse.de Date: Tue Aug 12 13:39:02 2008 +0200
ALSA: Allow drain ioctl for non-blocking mode
Could you try to revert this commit?
thanks,
Takashi
-- Vedran Miletić
-- Vedran Miletić
At Fri, 31 Oct 2008 20:30:00 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Yes, it works. I replaced mask with 0 in that line, and it works exactly the same. I didn't comment or uncomment anything.
Thanks for testing.
Is there some more testing needed?
No, I'll commit a patch.
BTW, can you explain in short what is the issue here? I would like to learn something along the way.
The problem is that this register wasn't initialized to any value by the driver. The original code sets two bits, but these are anyway set/reset dynamically at each open of MIDI devices, so they don't have to be set. Thus, the reasonable value to be set at first is zero.
Takashi
2008/10/26 Takashi Iwai tiwai@suse.de:
At Sun, 26 Oct 2008 17:31:02 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Yeap, that one does it. No need to revert it fully, though. I just uncommented the unsigned char mask line and removed that #if 0 and #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
Well, before doing that, I'd like to understand the problem more.
If the problem is about the initial IRQ mask value, setting 0 should work as well. Could you change the code just to do like below, and check whether it works? outb(0, ICEREG1724(ice, IRQMASK));
thanks,
Takashi
2008/10/21 Takashi Iwai tiwai@suse.de:
At Tue, 21 Oct 2008 10:49:18 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
No, that didn't fix it. :-(
vedran@kalopsia:~/Media$ mplayer -ao alsa:device=hw=1.0 -srate 22050 -format s32le get_video MPlayer 1.0rc2-4.3.1-DFSG-free (C) 2000-2007 MPlayer Team CPU: AMD Athlon(tm) Dual Core Processor 4450e (Family: 15, Model: 107, Stepping: 2) CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1 Compiled with runtime CPU detection. mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control.
Playing get_video. libavformat file format detected. [lavf] Video stream found, -vid 0 [lavf] Audio stream found, -aid 1 VIDEO: [FLV1] 320x240 0bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s) ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffflv] vfm: ffmpeg (FFmpeg Flash video) ========================================================================== ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 22050 Hz, 2 ch, s16le, 8.0 kbit/1.13% (ratio: 1000->88200) Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== AO: [alsa] 22050Hz 2ch s32le (4 bytes per sample) Starting playback... VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12) VDec: using Planar YV12 as output csp (no 0) Movie-Aspect is undefined - no prescaling applied. VO: [xv] 320x240 => 320x240 Planar YV12 A: 240.8 V: 245.3 A-V: -4.502 ct: -4.382 3350/3350 0% 0% 0.4% 0 0 [AO_ALSA] alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN failed: Input/output error
Did you build with CONFIG_SND_DEBUG=y? I guess you get a kernel error message like "playback drain error (DMA or IRQ..."
If so, a relevant patch is 1083206ff44af4baa03573b4a6bac430d9d70404, ALSA: ice1724 - Fix TX IRQ lockup
Try to revert it.
thanks,
Takashi
Exiting... (End of file)
2008/10/20 Takashi Iwai tiwai@suse.de:
At Sun, 19 Oct 2008 11:36:35 +0200, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote: > > I have: > 01:0a.0 Multimedia audio controller: VIA Technologies Inc. VT1720/24 > [Envy24PT/HT] PCI Multi-Channel Audio Controller (rev 01) > Subsystem: TERRATEC Electronic GmbH PHASE 22 > Flags: bus master, medium devsel, latency 64, IRQ 16 > I/O ports at c880 [size=32] > I/O ports at c800 [size=128] > Capabilities: [80] Power Management version 1 > Kernel driver in use: ICE1724 > Kernel modules: snd-ice1724 > I do this: > mplayer -ao alsa:device=hw=1.0 -srate 44100 -format s32le get_video > Before the song ends, last sample loops for about 20-30 times, and > then mplayer quits with error: > alsa-lib: pcm_hw.c:488:(snd_pcm_hw_drain) SNDRV_PCM_IOCTL_DRAIN > failed: Input/output error > > This doesn't happen on sound-2.6 and doesn't happen on > sound-unstable-2.6 with E-mu 1212m.
A suspicious commit is the one in topic/test branch,
commit 442dac7e02a835944bd4d6e429d0b4a2446e0204 Author: Takashi Iwai tiwai@suse.de Date: Tue Aug 12 13:39:02 2008 +0200
ALSA: Allow drain ioctl for non-blocking mode
Could you try to revert this commit?
thanks,
Takashi
-- Vedran Miletić
-- Vedran Miletić
-- Vedran Miletić
Hi Takashi,
Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai:
At Sun, 26 Oct 2008 17:31:02 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Yeap, that one does it. No need to revert it fully, though. I just uncommented the unsigned char mask line and removed that #if 0 and #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
Well, before doing that, I'd like to understand the problem more.
If the problem is about the initial IRQ mask value, setting 0 should work as well. Could you change the code just to do like below, and check whether it works? outb(0, ICEREG1724(ice, IRQMASK));
Makes a pc hang sometimes here, while reverting the entire patch is stable. no midi tested though, only audio.
Thanks, Karsten
Heh. I didn't test it long enough, apparently.
2008/11/1 Karsten Wiese fzu@wemgehoertderstaat.de:
Hi Takashi,
Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai:
At Sun, 26 Oct 2008 17:31:02 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Yeap, that one does it. No need to revert it fully, though. I just uncommented the unsigned char mask line and removed that #if 0 and #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
Well, before doing that, I'd like to understand the problem more.
If the problem is about the initial IRQ mask value, setting 0 should work as well. Could you change the code just to do like below, and check whether it works? outb(0, ICEREG1724(ice, IRQMASK));
Makes a pc hang sometimes here, while reverting the entire patch is stable. no midi tested though, only audio.
Thanks, Karsten
nAt Sat, 1 Nov 2008 19:08:59 +0200, Karsten Wiese wrote:
Hi Takashi,
Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai:
At Sun, 26 Oct 2008 17:31:02 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Yeap, that one does it. No need to revert it fully, though. I just uncommented the unsigned char mask line and removed that #if 0 and #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
Well, before doing that, I'd like to understand the problem more.
If the problem is about the initial IRQ mask value, setting 0 should work as well. Could you change the code just to do like below, and check whether it works? outb(0, ICEREG1724(ice, IRQMASK));
Makes a pc hang sometimes here, while reverting the entire patch is stable. no midi tested though, only audio.
Hmm, that's a bad news. Basically my change is just to disable MPU_TX irq when unresolved irqs occur. The detection was already there, but it was enabled only when CONFIG_SND_DEBUG.
So, the question is, whether does the hang-up happens even with the old code when you enable CONFIG_SND_DEBUG?
Also, a bit more detail would be appreciated -- what kind of hang-up, whether you get the error message, or so.
thanks,
Takashi
Am Sonntag, 2. November 2008 schrieb Takashi Iwai:
nAt Sat, 1 Nov 2008 19:08:59 +0200, Karsten Wiese wrote:
Hi Takashi,
Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai:
At Sun, 26 Oct 2008 17:31:02 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Yeap, that one does it. No need to revert it fully, though. I just uncommented the unsigned char mask line and removed that #if 0 and #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
Well, before doing that, I'd like to understand the problem more.
If the problem is about the initial IRQ mask value, setting 0 should work as well. Could you change the code just to do like below, and check whether it works? outb(0, ICEREG1724(ice, IRQMASK));
Makes a pc hang sometimes here, while reverting the entire patch is stable. no midi tested though, only audio.
Hmm, that's a bad news. Basically my change is just to disable MPU_TX irq when unresolved irqs occur. The detection was already there, but it was enabled only when CONFIG_SND_DEBUG.
So, the question is, whether does the hang-up happens even with the old code when you enable CONFIG_SND_DEBUG?
Also, a bit more detail would be appreciated -- what kind of hang-up, whether you get the error message, or so.
the hang happened on an always on production machine. I don't have a second card to test with currently, nor do i like to test on that machine again ;-)
May be its just that the mask has to be applied the other way round: I'd guess a 1 means "masked" or "not active".
@@ -382,23 +382,25 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) unsigned char status_mask = VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX | VT1724_IRQ_MTPCM; int handled = 0; -#ifdef CONFIG_SND_DEBUG int timeout = 0; -#endif
while (1) { status = inb(ICEREG1724(ice, IRQSTAT)); status &= status_mask; if (status == 0) break;
-#ifdef CONFIG_SND_DEBUG if (++timeout > 10) {
printk(KERN_ERR
"ice1724: Too long irq loop, status = 0x%x\n",
status);
status = inb(ICEREG1724(ice, IRQSTAT));
Not necessary to read from ICEREG1724(ice, IRQSTAT) a second time here.
printk(KERN_ERR "ice1724: Too long irq loop, "
"status = 0x%x\n", status);
if (status & VT1724_IRQ_MPU_TX) {
printk(KERN_ERR "ice1724: Disabling MPU_TX\n");
outb(inb(ICEREG1724(ice, IRQMASK)) &
~VT1724_IRQ_MPU_TX,
-------------------------------------^^^^^^^^^^^^^^^^^^ If I'm correct, your patch would re-activate or unmask VT1724_IRQ_MPU_TX.
ICEREG1724(ice, IRQMASK));
} break; }
-#endif
Thanks, Karsten
At Sun, 2 Nov 2008 15:21:05 +0200, Karsten Wiese wrote:
Am Sonntag, 2. November 2008 schrieb Takashi Iwai:
nAt Sat, 1 Nov 2008 19:08:59 +0200, Karsten Wiese wrote:
Hi Takashi,
Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai:
At Sun, 26 Oct 2008 17:31:02 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Yeap, that one does it. No need to revert it fully, though. I just uncommented the unsigned char mask line and removed that #if 0 and #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
Well, before doing that, I'd like to understand the problem more.
If the problem is about the initial IRQ mask value, setting 0 should work as well. Could you change the code just to do like below, and check whether it works? outb(0, ICEREG1724(ice, IRQMASK));
Makes a pc hang sometimes here, while reverting the entire patch is stable. no midi tested though, only audio.
Hmm, that's a bad news. Basically my change is just to disable MPU_TX irq when unresolved irqs occur. The detection was already there, but it was enabled only when CONFIG_SND_DEBUG.
So, the question is, whether does the hang-up happens even with the old code when you enable CONFIG_SND_DEBUG?
Also, a bit more detail would be appreciated -- what kind of hang-up, whether you get the error message, or so.
the hang happened on an always on production machine. I don't have a second card to test with currently, nor do i like to test on that machine again ;-)
May be its just that the mask has to be applied the other way round: I'd guess a 1 means "masked" or "not active".
Damn, you must be right! Could you give the patch below?
Takashi
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 40725df..0dfa054 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -395,8 +395,8 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) "status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); - outb(inb(ICEREG1724(ice, IRQMASK)) & - ~VT1724_IRQ_MPU_TX, + outb(inb(ICEREG1724(ice, IRQMASK)) | + VT1724_IRQ_MPU_TX, ICEREG1724(ice, IRQMASK)); } break; @@ -2413,8 +2413,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, return -EIO; }
- /* clear interrupts -- otherwise you'll get irq problems later */ - outb(0, ICEREG1724(ice, IRQMASK)); + /* MPU_RX and TX irq masks are cleared later dynamically */ + outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK));
/* don't handle FIFO overrun/underruns (just yet), * since they cause machine lockups
At Sun, 02 Nov 2008 19:21:37 +0100, I wrote:
At Sun, 2 Nov 2008 15:21:05 +0200, Karsten Wiese wrote:
Am Sonntag, 2. November 2008 schrieb Takashi Iwai:
nAt Sat, 1 Nov 2008 19:08:59 +0200, Karsten Wiese wrote:
Hi Takashi,
Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai:
At Sun, 26 Oct 2008 17:31:02 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Yeap, that one does it. No need to revert it fully, though. I just uncommented the unsigned char mask line and removed that #if 0 and #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
Well, before doing that, I'd like to understand the problem more.
If the problem is about the initial IRQ mask value, setting 0 should work as well. Could you change the code just to do like below, and check whether it works? outb(0, ICEREG1724(ice, IRQMASK));
Makes a pc hang sometimes here, while reverting the entire patch is stable. no midi tested though, only audio.
Hmm, that's a bad news. Basically my change is just to disable MPU_TX irq when unresolved irqs occur. The detection was already there, but it was enabled only when CONFIG_SND_DEBUG.
So, the question is, whether does the hang-up happens even with the old code when you enable CONFIG_SND_DEBUG?
Also, a bit more detail would be appreciated -- what kind of hang-up, whether you get the error message, or so.
the hang happened on an always on production machine. I don't have a second card to test with currently, nor do i like to test on that machine again ;-)
May be its just that the mask has to be applied the other way round: I'd guess a 1 means "masked" or "not active".
Damn, you must be right! Could you give the patch below?
... and looking through the code again, I think (hopefully) the patch below will fix the MIDI TX problem, too.
Could someone give it a try? It includes the previous patch.
thanks,
Takashi
--- diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 40725df..fd7b440 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -241,6 +241,9 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) struct snd_rawmidi_substream, list); }
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice, + u8 flag, int enable); + static void vt1724_midi_write(struct snd_ice1712 *ice) { struct snd_rawmidi_substream *s; @@ -254,6 +257,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) for (i = 0; i < count; ++i) outb(buffer[i], ICEREG1724(ice, MPU_DATA)); } + /* mask irq when all bytes have been transmitted. + * enabled again in output_trigger when the new data comes in. + */ + if (snd_rawmidi_transmit_empty(s)) + enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, 0); }
static void vt1724_midi_read(struct snd_ice1712 *ice) @@ -272,31 +280,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) } }
-static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, - u8 flag, int enable) +static void enable_midi_irq_unlocked(struct snd_ice1712 *ice, + u8 flag, int enable) { - struct snd_ice1712 *ice = substream->rmidi->private_data; - u8 mask; - - spin_lock_irq(&ice->reg_lock); - mask = inb(ICEREG1724(ice, IRQMASK)); + u8 mask = inb(ICEREG1724(ice, IRQMASK)); if (enable) mask &= ~flag; else mask |= flag; outb(mask, ICEREG1724(ice, IRQMASK)); +} + +static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, + u8 flag, int enable) +{ + struct snd_ice1712 *ice = substream->rmidi->private_data; + + spin_lock_irq(&ice->reg_lock); + enable_midi_irq_unlocked(ice, flag, enable); spin_unlock_irq(&ice->reg_lock); }
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) { - vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); return 0; }
static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) { - vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); return 0; }
@@ -306,6 +317,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) unsigned long flags;
spin_lock_irqsave(&ice->reg_lock, flags); + enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, up); if (up) { ice->midi_output = 1; vt1724_midi_write(ice); @@ -320,6 +332,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) struct snd_ice1712 *ice = s->rmidi->private_data; unsigned long timeout;
+ vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); /* 32 bytes should be transmitted in less than about 12 ms */ timeout = jiffies + msecs_to_jiffies(15); do { @@ -389,41 +402,41 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status &= status_mask; if (status == 0) break; + spin_lock(&ice->reg_lock); if (++timeout > 10) { status = inb(ICEREG1724(ice, IRQSTAT)); printk(KERN_ERR "ice1724: Too long irq loop, " "status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); - outb(inb(ICEREG1724(ice, IRQMASK)) & - ~VT1724_IRQ_MPU_TX, - ICEREG1724(ice, IRQMASK)); + enable_midi_irq_unlocked(ice, + VT1724_IRQ_MPU_TX, 0); } + spin_unlock(&ice->reg_lock); break; } handled = 1; if (status & VT1724_IRQ_MPU_TX) { - spin_lock(&ice->reg_lock); if (ice->midi_output) vt1724_midi_write(ice); - spin_unlock(&ice->reg_lock); +#if 0 /* should have been fixed */ /* Due to mysterical reasons, MPU_TX is always * generated (and can't be cleared) when a PCM * playback is going. So let's ignore at the * next loop. */ status_mask &= ~VT1724_IRQ_MPU_TX; +#endif } if (status & VT1724_IRQ_MPU_RX) { - spin_lock(&ice->reg_lock); if (ice->midi_input) vt1724_midi_read(ice); else vt1724_midi_clear_rx(ice); - spin_unlock(&ice->reg_lock); } /* ack MPU irq */ outb(status, ICEREG1724(ice, IRQSTAT)); + spin_unlock(&ice->reg_lock); if (status & VT1724_IRQ_MTPCM) { /* * Multi-track PCM @@ -2413,8 +2426,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, return -EIO; }
- /* clear interrupts -- otherwise you'll get irq problems later */ - outb(0, ICEREG1724(ice, IRQMASK)); + /* MPU_RX and TX irq masks are cleared later dynamically */ + outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK));
/* don't handle FIFO overrun/underruns (just yet), * since they cause machine lockups
How can I test if MIDI TX is broken?
2008/11/3 Takashi Iwai tiwai@suse.de:
At Sun, 02 Nov 2008 19:21:37 +0100, I wrote:
At Sun, 2 Nov 2008 15:21:05 +0200, Karsten Wiese wrote:
Am Sonntag, 2. November 2008 schrieb Takashi Iwai:
nAt Sat, 1 Nov 2008 19:08:59 +0200, Karsten Wiese wrote:
Hi Takashi,
Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai:
At Sun, 26 Oct 2008 17:31:02 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote: > > Yeap, that one does it. No need to revert it fully, though. I just > uncommented the unsigned char mask line and removed that #if 0 and > #endif. Now it works perfectly. Thanks! Can you fix it in your tree?
Well, before doing that, I'd like to understand the problem more.
If the problem is about the initial IRQ mask value, setting 0 should work as well. Could you change the code just to do like below, and check whether it works? outb(0, ICEREG1724(ice, IRQMASK));
Makes a pc hang sometimes here, while reverting the entire patch is stable. no midi tested though, only audio.
Hmm, that's a bad news. Basically my change is just to disable MPU_TX irq when unresolved irqs occur. The detection was already there, but it was enabled only when CONFIG_SND_DEBUG.
So, the question is, whether does the hang-up happens even with the old code when you enable CONFIG_SND_DEBUG?
Also, a bit more detail would be appreciated -- what kind of hang-up, whether you get the error message, or so.
the hang happened on an always on production machine. I don't have a second card to test with currently, nor do i like to test on that machine again ;-)
May be its just that the mask has to be applied the other way round: I'd guess a 1 means "masked" or "not active".
Damn, you must be right! Could you give the patch below?
... and looking through the code again, I think (hopefully) the patch below will fix the MIDI TX problem, too.
Could someone give it a try? It includes the previous patch.
thanks,
Takashi
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 40725df..fd7b440 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -241,6 +241,9 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) struct snd_rawmidi_substream, list); }
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable);
static void vt1724_midi_write(struct snd_ice1712 *ice) { struct snd_rawmidi_substream *s; @@ -254,6 +257,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) for (i = 0; i < count; ++i) outb(buffer[i], ICEREG1724(ice, MPU_DATA)); }
/* mask irq when all bytes have been transmitted.
* enabled again in output_trigger when the new data comes in.
*/
if (snd_rawmidi_transmit_empty(s))
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, 0);
}
static void vt1724_midi_read(struct snd_ice1712 *ice) @@ -272,31 +280,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) } }
-static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable)
{
struct snd_ice1712 *ice = substream->rmidi->private_data;
u8 mask;
spin_lock_irq(&ice->reg_lock);
mask = inb(ICEREG1724(ice, IRQMASK));
u8 mask = inb(ICEREG1724(ice, IRQMASK)); if (enable) mask &= ~flag; else mask |= flag; outb(mask, ICEREG1724(ice, IRQMASK));
+}
+static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+{
struct snd_ice1712 *ice = substream->rmidi->private_data;
spin_lock_irq(&ice->reg_lock);
enable_midi_irq_unlocked(ice, flag, enable); spin_unlock_irq(&ice->reg_lock);
}
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); return 0;
}
static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); return 0;
}
@@ -306,6 +317,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) unsigned long flags;
spin_lock_irqsave(&ice->reg_lock, flags);
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, up); if (up) { ice->midi_output = 1; vt1724_midi_write(ice);
@@ -320,6 +332,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) struct snd_ice1712 *ice = s->rmidi->private_data; unsigned long timeout;
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); /* 32 bytes should be transmitted in less than about 12 ms */ timeout = jiffies + msecs_to_jiffies(15); do {
@@ -389,41 +402,41 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status &= status_mask; if (status == 0) break;
spin_lock(&ice->reg_lock); if (++timeout > 10) { status = inb(ICEREG1724(ice, IRQSTAT)); printk(KERN_ERR "ice1724: Too long irq loop, " "status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { printk(KERN_ERR "ice1724: Disabling MPU_TX\n");
outb(inb(ICEREG1724(ice, IRQMASK)) &
~VT1724_IRQ_MPU_TX,
ICEREG1724(ice, IRQMASK));
enable_midi_irq_unlocked(ice,
VT1724_IRQ_MPU_TX, 0); }
spin_unlock(&ice->reg_lock); break; } handled = 1; if (status & VT1724_IRQ_MPU_TX) {
spin_lock(&ice->reg_lock); if (ice->midi_output) vt1724_midi_write(ice);
spin_unlock(&ice->reg_lock);
+#if 0 /* should have been fixed */ /* Due to mysterical reasons, MPU_TX is always * generated (and can't be cleared) when a PCM * playback is going. So let's ignore at the * next loop. */ status_mask &= ~VT1724_IRQ_MPU_TX; +#endif } if (status & VT1724_IRQ_MPU_RX) {
spin_lock(&ice->reg_lock); if (ice->midi_input) vt1724_midi_read(ice); else vt1724_midi_clear_rx(ice);
spin_unlock(&ice->reg_lock); } /* ack MPU irq */ outb(status, ICEREG1724(ice, IRQSTAT));
spin_unlock(&ice->reg_lock); if (status & VT1724_IRQ_MTPCM) { /* * Multi-track PCM
@@ -2413,8 +2426,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, return -EIO; }
/* clear interrupts -- otherwise you'll get irq problems later */
outb(0, ICEREG1724(ice, IRQMASK));
/* MPU_RX and TX irq masks are cleared later dynamically */
outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); /* don't handle FIFO overrun/underruns (just yet), * since they cause machine lockups
At Wed, 5 Nov 2008 15:45:43 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
How can I test if MIDI TX is broken?
Just run aplaymidi to the hardware port. It doesn't matter whether you connected to any device or not. Check the count in /proc/asound/card0/midi* proc file changes, and most importantly, the machine doesn't hang up.
thanks,
Takashi
2008/11/3 Takashi Iwai tiwai@suse.de:
At Sun, 02 Nov 2008 19:21:37 +0100, I wrote:
At Sun, 2 Nov 2008 15:21:05 +0200, Karsten Wiese wrote:
Am Sonntag, 2. November 2008 schrieb Takashi Iwai:
nAt Sat, 1 Nov 2008 19:08:59 +0200, Karsten Wiese wrote:
Hi Takashi,
Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai: > At Sun, 26 Oct 2008 17:31:02 +0100, > =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote: > > > > Yeap, that one does it. No need to revert it fully, though. I just > > uncommented the unsigned char mask line and removed that #if 0 and > > #endif. Now it works perfectly. Thanks! Can you fix it in your tree? > > Well, before doing that, I'd like to understand the problem more. > > If the problem is about the initial IRQ mask value, setting 0 should > work as well. > Could you change the code just to do like below, and check whether it > works? > outb(0, ICEREG1724(ice, IRQMASK));
Makes a pc hang sometimes here, while reverting the entire patch is stable. no midi tested though, only audio.
Hmm, that's a bad news. Basically my change is just to disable MPU_TX irq when unresolved irqs occur. The detection was already there, but it was enabled only when CONFIG_SND_DEBUG.
So, the question is, whether does the hang-up happens even with the old code when you enable CONFIG_SND_DEBUG?
Also, a bit more detail would be appreciated -- what kind of hang-up, whether you get the error message, or so.
the hang happened on an always on production machine. I don't have a second card to test with currently, nor do i like to test on that machine again ;-)
May be its just that the mask has to be applied the other way round: I'd guess a 1 means "masked" or "not active".
Damn, you must be right! Could you give the patch below?
... and looking through the code again, I think (hopefully) the patch below will fix the MIDI TX problem, too.
Could someone give it a try? It includes the previous patch.
thanks,
Takashi
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 40725df..fd7b440 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -241,6 +241,9 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) struct snd_rawmidi_substream, list); }
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable);
static void vt1724_midi_write(struct snd_ice1712 *ice) { struct snd_rawmidi_substream *s; @@ -254,6 +257,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) for (i = 0; i < count; ++i) outb(buffer[i], ICEREG1724(ice, MPU_DATA)); }
/* mask irq when all bytes have been transmitted.
* enabled again in output_trigger when the new data comes in.
*/
if (snd_rawmidi_transmit_empty(s))
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, 0);
}
static void vt1724_midi_read(struct snd_ice1712 *ice) @@ -272,31 +280,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) } }
-static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable)
{
struct snd_ice1712 *ice = substream->rmidi->private_data;
u8 mask;
spin_lock_irq(&ice->reg_lock);
mask = inb(ICEREG1724(ice, IRQMASK));
u8 mask = inb(ICEREG1724(ice, IRQMASK)); if (enable) mask &= ~flag; else mask |= flag; outb(mask, ICEREG1724(ice, IRQMASK));
+}
+static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+{
struct snd_ice1712 *ice = substream->rmidi->private_data;
spin_lock_irq(&ice->reg_lock);
enable_midi_irq_unlocked(ice, flag, enable); spin_unlock_irq(&ice->reg_lock);
}
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); return 0;
}
static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); return 0;
}
@@ -306,6 +317,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) unsigned long flags;
spin_lock_irqsave(&ice->reg_lock, flags);
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, up); if (up) { ice->midi_output = 1; vt1724_midi_write(ice);
@@ -320,6 +332,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) struct snd_ice1712 *ice = s->rmidi->private_data; unsigned long timeout;
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); /* 32 bytes should be transmitted in less than about 12 ms */ timeout = jiffies + msecs_to_jiffies(15); do {
@@ -389,41 +402,41 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status &= status_mask; if (status == 0) break;
spin_lock(&ice->reg_lock); if (++timeout > 10) { status = inb(ICEREG1724(ice, IRQSTAT)); printk(KERN_ERR "ice1724: Too long irq loop, " "status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { printk(KERN_ERR "ice1724: Disabling MPU_TX\n");
outb(inb(ICEREG1724(ice, IRQMASK)) &
~VT1724_IRQ_MPU_TX,
ICEREG1724(ice, IRQMASK));
enable_midi_irq_unlocked(ice,
VT1724_IRQ_MPU_TX, 0); }
spin_unlock(&ice->reg_lock); break; } handled = 1; if (status & VT1724_IRQ_MPU_TX) {
spin_lock(&ice->reg_lock); if (ice->midi_output) vt1724_midi_write(ice);
spin_unlock(&ice->reg_lock);
+#if 0 /* should have been fixed */ /* Due to mysterical reasons, MPU_TX is always * generated (and can't be cleared) when a PCM * playback is going. So let's ignore at the * next loop. */ status_mask &= ~VT1724_IRQ_MPU_TX; +#endif } if (status & VT1724_IRQ_MPU_RX) {
spin_lock(&ice->reg_lock); if (ice->midi_input) vt1724_midi_read(ice); else vt1724_midi_clear_rx(ice);
spin_unlock(&ice->reg_lock); } /* ack MPU irq */ outb(status, ICEREG1724(ice, IRQSTAT));
spin_unlock(&ice->reg_lock); if (status & VT1724_IRQ_MTPCM) { /* * Multi-track PCM
@@ -2413,8 +2426,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, return -EIO; }
/* clear interrupts -- otherwise you'll get irq problems later */
outb(0, ICEREG1724(ice, IRQMASK));
/* MPU_RX and TX irq masks are cleared later dynamically */
outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); /* don't handle FIFO overrun/underruns (just yet), * since they cause machine lockups
-- Vedran Miletić
OK, this will not be a problem. Can I apply your patch if I don't have a git tree, but just an unpacked snapshot?
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 15:45:43 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
How can I test if MIDI TX is broken?
Just run aplaymidi to the hardware port. It doesn't matter whether you connected to any device or not. Check the count in /proc/asound/card0/midi* proc file changes, and most importantly, the machine doesn't hang up.
thanks,
Takashi
2008/11/3 Takashi Iwai tiwai@suse.de:
At Sun, 02 Nov 2008 19:21:37 +0100, I wrote:
At Sun, 2 Nov 2008 15:21:05 +0200, Karsten Wiese wrote:
Am Sonntag, 2. November 2008 schrieb Takashi Iwai:
nAt Sat, 1 Nov 2008 19:08:59 +0200, Karsten Wiese wrote: > > Hi Takashi, > > Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai: > > At Sun, 26 Oct 2008 17:31:02 +0100, > > =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote: > > > > > > Yeap, that one does it. No need to revert it fully, though. I just > > > uncommented the unsigned char mask line and removed that #if 0 and > > > #endif. Now it works perfectly. Thanks! Can you fix it in your tree? > > > > Well, before doing that, I'd like to understand the problem more. > > > > If the problem is about the initial IRQ mask value, setting 0 should > > work as well. > > Could you change the code just to do like below, and check whether it > > works? > > outb(0, ICEREG1724(ice, IRQMASK)); > > Makes a pc hang sometimes here, while reverting the entire patch is stable. > no midi tested though, only audio.
Hmm, that's a bad news. Basically my change is just to disable MPU_TX irq when unresolved irqs occur. The detection was already there, but it was enabled only when CONFIG_SND_DEBUG.
So, the question is, whether does the hang-up happens even with the old code when you enable CONFIG_SND_DEBUG?
Also, a bit more detail would be appreciated -- what kind of hang-up, whether you get the error message, or so.
the hang happened on an always on production machine. I don't have a second card to test with currently, nor do i like to test on that machine again ;-)
May be its just that the mask has to be applied the other way round: I'd guess a 1 means "masked" or "not active".
Damn, you must be right! Could you give the patch below?
... and looking through the code again, I think (hopefully) the patch below will fix the MIDI TX problem, too.
Could someone give it a try? It includes the previous patch.
thanks,
Takashi
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 40725df..fd7b440 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -241,6 +241,9 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) struct snd_rawmidi_substream, list); }
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable);
static void vt1724_midi_write(struct snd_ice1712 *ice) { struct snd_rawmidi_substream *s; @@ -254,6 +257,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) for (i = 0; i < count; ++i) outb(buffer[i], ICEREG1724(ice, MPU_DATA)); }
/* mask irq when all bytes have been transmitted.
* enabled again in output_trigger when the new data comes in.
*/
if (snd_rawmidi_transmit_empty(s))
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, 0);
}
static void vt1724_midi_read(struct snd_ice1712 *ice) @@ -272,31 +280,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) } }
-static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable)
{
struct snd_ice1712 *ice = substream->rmidi->private_data;
u8 mask;
spin_lock_irq(&ice->reg_lock);
mask = inb(ICEREG1724(ice, IRQMASK));
u8 mask = inb(ICEREG1724(ice, IRQMASK)); if (enable) mask &= ~flag; else mask |= flag; outb(mask, ICEREG1724(ice, IRQMASK));
+}
+static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+{
struct snd_ice1712 *ice = substream->rmidi->private_data;
spin_lock_irq(&ice->reg_lock);
enable_midi_irq_unlocked(ice, flag, enable); spin_unlock_irq(&ice->reg_lock);
}
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); return 0;
}
static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); return 0;
}
@@ -306,6 +317,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) unsigned long flags;
spin_lock_irqsave(&ice->reg_lock, flags);
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, up); if (up) { ice->midi_output = 1; vt1724_midi_write(ice);
@@ -320,6 +332,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) struct snd_ice1712 *ice = s->rmidi->private_data; unsigned long timeout;
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); /* 32 bytes should be transmitted in less than about 12 ms */ timeout = jiffies + msecs_to_jiffies(15); do {
@@ -389,41 +402,41 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status &= status_mask; if (status == 0) break;
spin_lock(&ice->reg_lock); if (++timeout > 10) { status = inb(ICEREG1724(ice, IRQSTAT)); printk(KERN_ERR "ice1724: Too long irq loop, " "status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { printk(KERN_ERR "ice1724: Disabling MPU_TX\n");
outb(inb(ICEREG1724(ice, IRQMASK)) &
~VT1724_IRQ_MPU_TX,
ICEREG1724(ice, IRQMASK));
enable_midi_irq_unlocked(ice,
VT1724_IRQ_MPU_TX, 0); }
spin_unlock(&ice->reg_lock); break; } handled = 1; if (status & VT1724_IRQ_MPU_TX) {
spin_lock(&ice->reg_lock); if (ice->midi_output) vt1724_midi_write(ice);
spin_unlock(&ice->reg_lock);
+#if 0 /* should have been fixed */ /* Due to mysterical reasons, MPU_TX is always * generated (and can't be cleared) when a PCM * playback is going. So let's ignore at the * next loop. */ status_mask &= ~VT1724_IRQ_MPU_TX; +#endif } if (status & VT1724_IRQ_MPU_RX) {
spin_lock(&ice->reg_lock); if (ice->midi_input) vt1724_midi_read(ice); else vt1724_midi_clear_rx(ice);
spin_unlock(&ice->reg_lock); } /* ack MPU irq */ outb(status, ICEREG1724(ice, IRQSTAT));
spin_unlock(&ice->reg_lock); if (status & VT1724_IRQ_MTPCM) { /* * Multi-track PCM
@@ -2413,8 +2426,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, return -EIO; }
/* clear interrupts -- otherwise you'll get irq problems later */
outb(0, ICEREG1724(ice, IRQMASK));
/* MPU_RX and TX irq masks are cleared later dynamically */
outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); /* don't handle FIFO overrun/underruns (just yet), * since they cause machine lockups
-- Vedran Miletić
At Wed, 5 Nov 2008 15:54:21 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
OK, this will not be a problem. Can I apply your patch if I don't have a git tree, but just an unpacked snapshot?
The snapshot doesn't include the patch yet since it's untested. Please apply my patch anyway.
As you see, there are two patches. One is just for fixing PCM thing. Try this one first. If this works, try the next one, which could .
thanks,
Takashi
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 15:45:43 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
How can I test if MIDI TX is broken?
Just run aplaymidi to the hardware port. It doesn't matter whether you connected to any device or not. Check the count in /proc/asound/card0/midi* proc file changes, and most importantly, the machine doesn't hang up.
thanks,
Takashi
2008/11/3 Takashi Iwai tiwai@suse.de:
At Sun, 02 Nov 2008 19:21:37 +0100, I wrote:
At Sun, 2 Nov 2008 15:21:05 +0200, Karsten Wiese wrote:
Am Sonntag, 2. November 2008 schrieb Takashi Iwai: > nAt Sat, 1 Nov 2008 19:08:59 +0200, > Karsten Wiese wrote: > > > > Hi Takashi, > > > > Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai: > > > At Sun, 26 Oct 2008 17:31:02 +0100, > > > =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote: > > > > > > > > Yeap, that one does it. No need to revert it fully, though. I just > > > > uncommented the unsigned char mask line and removed that #if 0 and > > > > #endif. Now it works perfectly. Thanks! Can you fix it in your tree? > > > > > > Well, before doing that, I'd like to understand the problem more. > > > > > > If the problem is about the initial IRQ mask value, setting 0 should > > > work as well. > > > Could you change the code just to do like below, and check whether it > > > works? > > > outb(0, ICEREG1724(ice, IRQMASK)); > > > > Makes a pc hang sometimes here, while reverting the entire patch is stable. > > no midi tested though, only audio. > > Hmm, that's a bad news. > Basically my change is just to disable MPU_TX irq when unresolved irqs > occur. The detection was already there, but it was enabled only when > CONFIG_SND_DEBUG. > > So, the question is, whether does the hang-up happens even with the > old code when you enable CONFIG_SND_DEBUG? > > Also, a bit more detail would be appreciated -- what kind of hang-up, > whether you get the error message, or so.
the hang happened on an always on production machine. I don't have a second card to test with currently, nor do i like to test on that machine again ;-)
May be its just that the mask has to be applied the other way round: I'd guess a 1 means "masked" or "not active".
Damn, you must be right! Could you give the patch below?
... and looking through the code again, I think (hopefully) the patch below will fix the MIDI TX problem, too.
Could someone give it a try? It includes the previous patch.
thanks,
Takashi
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 40725df..fd7b440 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -241,6 +241,9 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) struct snd_rawmidi_substream, list); }
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable);
static void vt1724_midi_write(struct snd_ice1712 *ice) { struct snd_rawmidi_substream *s; @@ -254,6 +257,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) for (i = 0; i < count; ++i) outb(buffer[i], ICEREG1724(ice, MPU_DATA)); }
/* mask irq when all bytes have been transmitted.
* enabled again in output_trigger when the new data comes in.
*/
if (snd_rawmidi_transmit_empty(s))
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, 0);
}
static void vt1724_midi_read(struct snd_ice1712 *ice) @@ -272,31 +280,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) } }
-static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable)
{
struct snd_ice1712 *ice = substream->rmidi->private_data;
u8 mask;
spin_lock_irq(&ice->reg_lock);
mask = inb(ICEREG1724(ice, IRQMASK));
u8 mask = inb(ICEREG1724(ice, IRQMASK)); if (enable) mask &= ~flag; else mask |= flag; outb(mask, ICEREG1724(ice, IRQMASK));
+}
+static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+{
struct snd_ice1712 *ice = substream->rmidi->private_data;
spin_lock_irq(&ice->reg_lock);
enable_midi_irq_unlocked(ice, flag, enable); spin_unlock_irq(&ice->reg_lock);
}
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); return 0;
}
static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); return 0;
}
@@ -306,6 +317,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) unsigned long flags;
spin_lock_irqsave(&ice->reg_lock, flags);
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, up); if (up) { ice->midi_output = 1; vt1724_midi_write(ice);
@@ -320,6 +332,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) struct snd_ice1712 *ice = s->rmidi->private_data; unsigned long timeout;
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); /* 32 bytes should be transmitted in less than about 12 ms */ timeout = jiffies + msecs_to_jiffies(15); do {
@@ -389,41 +402,41 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status &= status_mask; if (status == 0) break;
spin_lock(&ice->reg_lock); if (++timeout > 10) { status = inb(ICEREG1724(ice, IRQSTAT)); printk(KERN_ERR "ice1724: Too long irq loop, " "status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { printk(KERN_ERR "ice1724: Disabling MPU_TX\n");
outb(inb(ICEREG1724(ice, IRQMASK)) &
~VT1724_IRQ_MPU_TX,
ICEREG1724(ice, IRQMASK));
enable_midi_irq_unlocked(ice,
VT1724_IRQ_MPU_TX, 0); }
spin_unlock(&ice->reg_lock); break; } handled = 1; if (status & VT1724_IRQ_MPU_TX) {
spin_lock(&ice->reg_lock); if (ice->midi_output) vt1724_midi_write(ice);
spin_unlock(&ice->reg_lock);
+#if 0 /* should have been fixed */ /* Due to mysterical reasons, MPU_TX is always * generated (and can't be cleared) when a PCM * playback is going. So let's ignore at the * next loop. */ status_mask &= ~VT1724_IRQ_MPU_TX; +#endif } if (status & VT1724_IRQ_MPU_RX) {
spin_lock(&ice->reg_lock); if (ice->midi_input) vt1724_midi_read(ice); else vt1724_midi_clear_rx(ice);
spin_unlock(&ice->reg_lock); } /* ack MPU irq */ outb(status, ICEREG1724(ice, IRQSTAT));
spin_unlock(&ice->reg_lock); if (status & VT1724_IRQ_MTPCM) { /* * Multi-track PCM
@@ -2413,8 +2426,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, return -EIO; }
/* clear interrupts -- otherwise you'll get irq problems later */
outb(0, ICEREG1724(ice, IRQMASK));
/* MPU_RX and TX irq masks are cleared later dynamically */
outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); /* don't handle FIFO overrun/underruns (just yet), * since they cause machine lockups
-- Vedran Miletić
-- Vedran Miletić
OK. Actually, I was asking what is the command to apply patch to a snapshot, if there is one.
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 15:54:21 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
OK, this will not be a problem. Can I apply your patch if I don't have a git tree, but just an unpacked snapshot?
The snapshot doesn't include the patch yet since it's untested. Please apply my patch anyway.
As you see, there are two patches. One is just for fixing PCM thing. Try this one first. If this works, try the next one, which could .
thanks,
Takashi
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 15:45:43 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
How can I test if MIDI TX is broken?
Just run aplaymidi to the hardware port. It doesn't matter whether you connected to any device or not. Check the count in /proc/asound/card0/midi* proc file changes, and most importantly, the machine doesn't hang up.
thanks,
Takashi
2008/11/3 Takashi Iwai tiwai@suse.de:
At Sun, 02 Nov 2008 19:21:37 +0100, I wrote:
At Sun, 2 Nov 2008 15:21:05 +0200, Karsten Wiese wrote: > > Am Sonntag, 2. November 2008 schrieb Takashi Iwai: > > nAt Sat, 1 Nov 2008 19:08:59 +0200, > > Karsten Wiese wrote: > > > > > > Hi Takashi, > > > > > > Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai: > > > > At Sun, 26 Oct 2008 17:31:02 +0100, > > > > =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote: > > > > > > > > > > Yeap, that one does it. No need to revert it fully, though. I just > > > > > uncommented the unsigned char mask line and removed that #if 0 and > > > > > #endif. Now it works perfectly. Thanks! Can you fix it in your tree? > > > > > > > > Well, before doing that, I'd like to understand the problem more. > > > > > > > > If the problem is about the initial IRQ mask value, setting 0 should > > > > work as well. > > > > Could you change the code just to do like below, and check whether it > > > > works? > > > > outb(0, ICEREG1724(ice, IRQMASK)); > > > > > > Makes a pc hang sometimes here, while reverting the entire patch is stable. > > > no midi tested though, only audio. > > > > Hmm, that's a bad news. > > Basically my change is just to disable MPU_TX irq when unresolved irqs > > occur. The detection was already there, but it was enabled only when > > CONFIG_SND_DEBUG. > > > > So, the question is, whether does the hang-up happens even with the > > old code when you enable CONFIG_SND_DEBUG? > > > > Also, a bit more detail would be appreciated -- what kind of hang-up, > > whether you get the error message, or so. > > the hang happened on an always on production machine. I don't have a second > card to test with currently, nor do i like to test on that machine again ;-) > > May be its just that the mask has to be applied the other way round: > I'd guess a 1 means "masked" or "not active".
Damn, you must be right! Could you give the patch below?
... and looking through the code again, I think (hopefully) the patch below will fix the MIDI TX problem, too.
Could someone give it a try? It includes the previous patch.
thanks,
Takashi
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 40725df..fd7b440 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -241,6 +241,9 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) struct snd_rawmidi_substream, list); }
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable);
static void vt1724_midi_write(struct snd_ice1712 *ice) { struct snd_rawmidi_substream *s; @@ -254,6 +257,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) for (i = 0; i < count; ++i) outb(buffer[i], ICEREG1724(ice, MPU_DATA)); }
/* mask irq when all bytes have been transmitted.
* enabled again in output_trigger when the new data comes in.
*/
if (snd_rawmidi_transmit_empty(s))
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, 0);
}
static void vt1724_midi_read(struct snd_ice1712 *ice) @@ -272,31 +280,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) } }
-static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable)
{
struct snd_ice1712 *ice = substream->rmidi->private_data;
u8 mask;
spin_lock_irq(&ice->reg_lock);
mask = inb(ICEREG1724(ice, IRQMASK));
u8 mask = inb(ICEREG1724(ice, IRQMASK)); if (enable) mask &= ~flag; else mask |= flag; outb(mask, ICEREG1724(ice, IRQMASK));
+}
+static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+{
struct snd_ice1712 *ice = substream->rmidi->private_data;
spin_lock_irq(&ice->reg_lock);
enable_midi_irq_unlocked(ice, flag, enable); spin_unlock_irq(&ice->reg_lock);
}
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); return 0;
}
static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); return 0;
}
@@ -306,6 +317,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) unsigned long flags;
spin_lock_irqsave(&ice->reg_lock, flags);
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, up); if (up) { ice->midi_output = 1; vt1724_midi_write(ice);
@@ -320,6 +332,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) struct snd_ice1712 *ice = s->rmidi->private_data; unsigned long timeout;
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); /* 32 bytes should be transmitted in less than about 12 ms */ timeout = jiffies + msecs_to_jiffies(15); do {
@@ -389,41 +402,41 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status &= status_mask; if (status == 0) break;
spin_lock(&ice->reg_lock); if (++timeout > 10) { status = inb(ICEREG1724(ice, IRQSTAT)); printk(KERN_ERR "ice1724: Too long irq loop, " "status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { printk(KERN_ERR "ice1724: Disabling MPU_TX\n");
outb(inb(ICEREG1724(ice, IRQMASK)) &
~VT1724_IRQ_MPU_TX,
ICEREG1724(ice, IRQMASK));
enable_midi_irq_unlocked(ice,
VT1724_IRQ_MPU_TX, 0); }
spin_unlock(&ice->reg_lock); break; } handled = 1; if (status & VT1724_IRQ_MPU_TX) {
spin_lock(&ice->reg_lock); if (ice->midi_output) vt1724_midi_write(ice);
spin_unlock(&ice->reg_lock);
+#if 0 /* should have been fixed */ /* Due to mysterical reasons, MPU_TX is always * generated (and can't be cleared) when a PCM * playback is going. So let's ignore at the * next loop. */ status_mask &= ~VT1724_IRQ_MPU_TX; +#endif } if (status & VT1724_IRQ_MPU_RX) {
spin_lock(&ice->reg_lock); if (ice->midi_input) vt1724_midi_read(ice); else vt1724_midi_clear_rx(ice);
spin_unlock(&ice->reg_lock); } /* ack MPU irq */ outb(status, ICEREG1724(ice, IRQSTAT));
spin_unlock(&ice->reg_lock); if (status & VT1724_IRQ_MTPCM) { /* * Multi-track PCM
@@ -2413,8 +2426,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, return -EIO; }
/* clear interrupts -- otherwise you'll get irq problems later */
outb(0, ICEREG1724(ice, IRQMASK));
/* MPU_RX and TX irq masks are cleared later dynamically */
outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); /* don't handle FIFO overrun/underruns (just yet), * since they cause machine lockups
-- Vedran Miletić
-- Vedran Miletić
At Wed, 5 Nov 2008 16:08:19 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
OK. Actually, I was asking what is the command to apply patch to a snapshot, if there is one.
Are you asking the usage of patch program? For linux-kernel patch (sound/* path), do like below:
% cd alsa-driver*/alsa-kernel % patch -p2 < fix-patch-file-path
Takashi
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 15:54:21 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
OK, this will not be a problem. Can I apply your patch if I don't have a git tree, but just an unpacked snapshot?
The snapshot doesn't include the patch yet since it's untested. Please apply my patch anyway.
As you see, there are two patches. One is just for fixing PCM thing. Try this one first. If this works, try the next one, which could .
thanks,
Takashi
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 15:45:43 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
How can I test if MIDI TX is broken?
Just run aplaymidi to the hardware port. It doesn't matter whether you connected to any device or not. Check the count in /proc/asound/card0/midi* proc file changes, and most importantly, the machine doesn't hang up.
thanks,
Takashi
2008/11/3 Takashi Iwai tiwai@suse.de:
At Sun, 02 Nov 2008 19:21:37 +0100, I wrote: > > At Sun, 2 Nov 2008 15:21:05 +0200, > Karsten Wiese wrote: > > > > Am Sonntag, 2. November 2008 schrieb Takashi Iwai: > > > nAt Sat, 1 Nov 2008 19:08:59 +0200, > > > Karsten Wiese wrote: > > > > > > > > Hi Takashi, > > > > > > > > Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai: > > > > > At Sun, 26 Oct 2008 17:31:02 +0100, > > > > > =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote: > > > > > > > > > > > > Yeap, that one does it. No need to revert it fully, though. I just > > > > > > uncommented the unsigned char mask line and removed that #if 0 and > > > > > > #endif. Now it works perfectly. Thanks! Can you fix it in your tree? > > > > > > > > > > Well, before doing that, I'd like to understand the problem more. > > > > > > > > > > If the problem is about the initial IRQ mask value, setting 0 should > > > > > work as well. > > > > > Could you change the code just to do like below, and check whether it > > > > > works? > > > > > outb(0, ICEREG1724(ice, IRQMASK)); > > > > > > > > Makes a pc hang sometimes here, while reverting the entire patch is stable. > > > > no midi tested though, only audio. > > > > > > Hmm, that's a bad news. > > > Basically my change is just to disable MPU_TX irq when unresolved irqs > > > occur. The detection was already there, but it was enabled only when > > > CONFIG_SND_DEBUG. > > > > > > So, the question is, whether does the hang-up happens even with the > > > old code when you enable CONFIG_SND_DEBUG? > > > > > > Also, a bit more detail would be appreciated -- what kind of hang-up, > > > whether you get the error message, or so. > > > > the hang happened on an always on production machine. I don't have a second > > card to test with currently, nor do i like to test on that machine again ;-) > > > > May be its just that the mask has to be applied the other way round: > > I'd guess a 1 means "masked" or "not active". > > Damn, you must be right! > Could you give the patch below?
... and looking through the code again, I think (hopefully) the patch below will fix the MIDI TX problem, too.
Could someone give it a try? It includes the previous patch.
thanks,
Takashi
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 40725df..fd7b440 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -241,6 +241,9 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) struct snd_rawmidi_substream, list); }
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable);
static void vt1724_midi_write(struct snd_ice1712 *ice) { struct snd_rawmidi_substream *s; @@ -254,6 +257,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) for (i = 0; i < count; ++i) outb(buffer[i], ICEREG1724(ice, MPU_DATA)); }
/* mask irq when all bytes have been transmitted.
* enabled again in output_trigger when the new data comes in.
*/
if (snd_rawmidi_transmit_empty(s))
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, 0);
}
static void vt1724_midi_read(struct snd_ice1712 *ice) @@ -272,31 +280,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) } }
-static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+static void enable_midi_irq_unlocked(struct snd_ice1712 *ice,
u8 flag, int enable)
{
struct snd_ice1712 *ice = substream->rmidi->private_data;
u8 mask;
spin_lock_irq(&ice->reg_lock);
mask = inb(ICEREG1724(ice, IRQMASK));
u8 mask = inb(ICEREG1724(ice, IRQMASK)); if (enable) mask &= ~flag; else mask |= flag; outb(mask, ICEREG1724(ice, IRQMASK));
+}
+static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream,
u8 flag, int enable)
+{
struct snd_ice1712 *ice = substream->rmidi->private_data;
spin_lock_irq(&ice->reg_lock);
enable_midi_irq_unlocked(ice, flag, enable); spin_unlock_irq(&ice->reg_lock);
}
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); return 0;
}
static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) {
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); return 0;
}
@@ -306,6 +317,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) unsigned long flags;
spin_lock_irqsave(&ice->reg_lock, flags);
enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, up); if (up) { ice->midi_output = 1; vt1724_midi_write(ice);
@@ -320,6 +332,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) struct snd_ice1712 *ice = s->rmidi->private_data; unsigned long timeout;
vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); /* 32 bytes should be transmitted in less than about 12 ms */ timeout = jiffies + msecs_to_jiffies(15); do {
@@ -389,41 +402,41 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status &= status_mask; if (status == 0) break;
spin_lock(&ice->reg_lock); if (++timeout > 10) { status = inb(ICEREG1724(ice, IRQSTAT)); printk(KERN_ERR "ice1724: Too long irq loop, " "status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { printk(KERN_ERR "ice1724: Disabling MPU_TX\n");
outb(inb(ICEREG1724(ice, IRQMASK)) &
~VT1724_IRQ_MPU_TX,
ICEREG1724(ice, IRQMASK));
enable_midi_irq_unlocked(ice,
VT1724_IRQ_MPU_TX, 0); }
spin_unlock(&ice->reg_lock); break; } handled = 1; if (status & VT1724_IRQ_MPU_TX) {
spin_lock(&ice->reg_lock); if (ice->midi_output) vt1724_midi_write(ice);
spin_unlock(&ice->reg_lock);
+#if 0 /* should have been fixed */ /* Due to mysterical reasons, MPU_TX is always * generated (and can't be cleared) when a PCM * playback is going. So let's ignore at the * next loop. */ status_mask &= ~VT1724_IRQ_MPU_TX; +#endif } if (status & VT1724_IRQ_MPU_RX) {
spin_lock(&ice->reg_lock); if (ice->midi_input) vt1724_midi_read(ice); else vt1724_midi_clear_rx(ice);
spin_unlock(&ice->reg_lock); } /* ack MPU irq */ outb(status, ICEREG1724(ice, IRQSTAT));
spin_unlock(&ice->reg_lock); if (status & VT1724_IRQ_MTPCM) { /* * Multi-track PCM
@@ -2413,8 +2426,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, return -EIO; }
/* clear interrupts -- otherwise you'll get irq problems later */
outb(0, ICEREG1724(ice, IRQMASK));
/* MPU_RX and TX irq masks are cleared later dynamically */
outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); /* don't handle FIFO overrun/underruns (just yet), * since they cause machine lockups
-- Vedran Miletić
-- Vedran Miletić
-- Vedran Miletić
Without any patching it works.
vedran@kalopsia:~$ cat /proc/asound/card1/midi0 ICE1724 MIDI
Output 0 Tx bytes : 27753 Mode : native Buffer size : 4096 Avail : 4096 Input 0 Rx bytes : 0
How far do I need to test it? Is this enough?
Let me now try patched one...
Cool. Didn't know it was that easy. Also, I didn't expect it to work since file is already patched by alsa-driver compatibility for older kernels, but I was pleasantly surprised: vedran@kalopsia:~/bin/alsa-driver-unstable/alsa-kernel$ patch -p2 < /home/vedran/bin/ice1724-takashi.patch (second one you posted) patching file pci/ice1712/ice1724.c Hunk #1 succeeded at 243 (offset 2 lines). Hunk #2 succeeded at 259 (offset 2 lines). Hunk #3 succeeded at 282 (offset 2 lines). Hunk #4 succeeded at 319 (offset 2 lines). Hunk #5 succeeded at 334 (offset 2 lines). Hunk #6 succeeded at 404 (offset 2 lines). Hunk #7 succeeded at 2458 (offset 32 lines).
MIDI works, no change here. However, mplayer (on both analog and digital) fills dmesg with: [ 1921.595750] ice1724: Too long irq loop, status = 0x20 [ 1921.595775] ice1724: Disabling MPU_TX [ 1921.630993] ice1724: Too long irq loop, status = 0x20 [ 1921.630993] ice1724: Disabling MPU_TX [ 1921.662976] ice1724: Too long irq loop, status = 0x20 [ 1921.662976] ice1724: Disabling MPU_TX [ 1921.694977] ice1724: Too long irq loop, status = 0x20 [ 1921.694977] ice1724: Disabling MPU_TX [ 1921.726998] ice1724: Too long irq loop, status = 0x20 [ 1921.726998] ice1724: Disabling MPU_TX [ 1921.759213] ice1724: Too long irq loop, status = 0x20 [ 1921.759213] ice1724: Disabling MPU_TX [ 1921.791289] ice1724: Too long irq loop, status = 0x20 [ 1921.791289] ice1724: Disabling MPU_TX [ 1921.823276] ice1724: Too long irq loop, status = 0x20 [ 1921.823276] ice1724: Disabling MPU_TX [ 1921.855159] ice1724: Too long irq loop, status = 0x20 [ 1921.855159] ice1724: Disabling MPU_TX
This doesn't happen without patch. Audio works normally.
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 16:08:19 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
OK. Actually, I was asking what is the command to apply patch to a snapshot, if there is one.
Are you asking the usage of patch program? For linux-kernel patch (sound/* path), do like below:
% cd alsa-driver*/alsa-kernel % patch -p2 < fix-patch-file-path
Takashi
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 15:54:21 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
OK, this will not be a problem. Can I apply your patch if I don't have a git tree, but just an unpacked snapshot?
The snapshot doesn't include the patch yet since it's untested. Please apply my patch anyway.
As you see, there are two patches. One is just for fixing PCM thing. Try this one first. If this works, try the next one, which could .
thanks,
Takashi
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 15:45:43 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
How can I test if MIDI TX is broken?
Just run aplaymidi to the hardware port. It doesn't matter whether you connected to any device or not. Check the count in /proc/asound/card0/midi* proc file changes, and most importantly, the machine doesn't hang up.
thanks,
Takashi
2008/11/3 Takashi Iwai tiwai@suse.de: > At Sun, 02 Nov 2008 19:21:37 +0100, > I wrote: >> >> At Sun, 2 Nov 2008 15:21:05 +0200, >> Karsten Wiese wrote: >> > >> > Am Sonntag, 2. November 2008 schrieb Takashi Iwai: >> > > nAt Sat, 1 Nov 2008 19:08:59 +0200, >> > > Karsten Wiese wrote: >> > > > >> > > > Hi Takashi, >> > > > >> > > > Am Sonntag, 26. Oktober 2008 schrieb Takashi Iwai: >> > > > > At Sun, 26 Oct 2008 17:31:02 +0100, >> > > > > =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote: >> > > > > > >> > > > > > Yeap, that one does it. No need to revert it fully, though. I just >> > > > > > uncommented the unsigned char mask line and removed that #if 0 and >> > > > > > #endif. Now it works perfectly. Thanks! Can you fix it in your tree? >> > > > > >> > > > > Well, before doing that, I'd like to understand the problem more. >> > > > > >> > > > > If the problem is about the initial IRQ mask value, setting 0 should >> > > > > work as well. >> > > > > Could you change the code just to do like below, and check whether it >> > > > > works? >> > > > > outb(0, ICEREG1724(ice, IRQMASK)); >> > > > >> > > > Makes a pc hang sometimes here, while reverting the entire patch is stable. >> > > > no midi tested though, only audio. >> > > >> > > Hmm, that's a bad news. >> > > Basically my change is just to disable MPU_TX irq when unresolved irqs >> > > occur. The detection was already there, but it was enabled only when >> > > CONFIG_SND_DEBUG. >> > > >> > > So, the question is, whether does the hang-up happens even with the >> > > old code when you enable CONFIG_SND_DEBUG? >> > > >> > > Also, a bit more detail would be appreciated -- what kind of hang-up, >> > > whether you get the error message, or so. >> > >> > the hang happened on an always on production machine. I don't have a second >> > card to test with currently, nor do i like to test on that machine again ;-) >> > >> > May be its just that the mask has to be applied the other way round: >> > I'd guess a 1 means "masked" or "not active". >> >> Damn, you must be right! >> Could you give the patch below? > > ... and looking through the code again, I think (hopefully) the patch > below will fix the MIDI TX problem, too. > > Could someone give it a try? It includes the previous patch. > > > thanks, > > Takashi > > --- > diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c > index 40725df..fd7b440 100644 > --- a/sound/pci/ice1712/ice1724.c > +++ b/sound/pci/ice1712/ice1724.c > @@ -241,6 +241,9 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) > struct snd_rawmidi_substream, list); > } > > +static void enable_midi_irq_unlocked(struct snd_ice1712 *ice, > + u8 flag, int enable); > + > static void vt1724_midi_write(struct snd_ice1712 *ice) > { > struct snd_rawmidi_substream *s; > @@ -254,6 +257,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) > for (i = 0; i < count; ++i) > outb(buffer[i], ICEREG1724(ice, MPU_DATA)); > } > + /* mask irq when all bytes have been transmitted. > + * enabled again in output_trigger when the new data comes in. > + */ > + if (snd_rawmidi_transmit_empty(s)) > + enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, 0); > } > > static void vt1724_midi_read(struct snd_ice1712 *ice) > @@ -272,31 +280,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) > } > } > > -static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, > - u8 flag, int enable) > +static void enable_midi_irq_unlocked(struct snd_ice1712 *ice, > + u8 flag, int enable) > { > - struct snd_ice1712 *ice = substream->rmidi->private_data; > - u8 mask; > - > - spin_lock_irq(&ice->reg_lock); > - mask = inb(ICEREG1724(ice, IRQMASK)); > + u8 mask = inb(ICEREG1724(ice, IRQMASK)); > if (enable) > mask &= ~flag; > else > mask |= flag; > outb(mask, ICEREG1724(ice, IRQMASK)); > +} > + > +static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, > + u8 flag, int enable) > +{ > + struct snd_ice1712 *ice = substream->rmidi->private_data; > + > + spin_lock_irq(&ice->reg_lock); > + enable_midi_irq_unlocked(ice, flag, enable); > spin_unlock_irq(&ice->reg_lock); > } > > static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) > { > - vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); > return 0; > } > > static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) > { > - vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); > return 0; > } > > @@ -306,6 +317,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) > unsigned long flags; > > spin_lock_irqsave(&ice->reg_lock, flags); > + enable_midi_irq_unlocked(ice, VT1724_IRQ_MPU_TX, up); > if (up) { > ice->midi_output = 1; > vt1724_midi_write(ice); > @@ -320,6 +332,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) > struct snd_ice1712 *ice = s->rmidi->private_data; > unsigned long timeout; > > + vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); > /* 32 bytes should be transmitted in less than about 12 ms */ > timeout = jiffies + msecs_to_jiffies(15); > do { > @@ -389,41 +402,41 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) > status &= status_mask; > if (status == 0) > break; > + spin_lock(&ice->reg_lock); > if (++timeout > 10) { > status = inb(ICEREG1724(ice, IRQSTAT)); > printk(KERN_ERR "ice1724: Too long irq loop, " > "status = 0x%x\n", status); > if (status & VT1724_IRQ_MPU_TX) { > printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); > - outb(inb(ICEREG1724(ice, IRQMASK)) & > - ~VT1724_IRQ_MPU_TX, > - ICEREG1724(ice, IRQMASK)); > + enable_midi_irq_unlocked(ice, > + VT1724_IRQ_MPU_TX, 0); > } > + spin_unlock(&ice->reg_lock); > break; > } > handled = 1; > if (status & VT1724_IRQ_MPU_TX) { > - spin_lock(&ice->reg_lock); > if (ice->midi_output) > vt1724_midi_write(ice); > - spin_unlock(&ice->reg_lock); > +#if 0 /* should have been fixed */ > /* Due to mysterical reasons, MPU_TX is always > * generated (and can't be cleared) when a PCM > * playback is going. So let's ignore at the > * next loop. > */ > status_mask &= ~VT1724_IRQ_MPU_TX; > +#endif > } > if (status & VT1724_IRQ_MPU_RX) { > - spin_lock(&ice->reg_lock); > if (ice->midi_input) > vt1724_midi_read(ice); > else > vt1724_midi_clear_rx(ice); > - spin_unlock(&ice->reg_lock); > } > /* ack MPU irq */ > outb(status, ICEREG1724(ice, IRQSTAT)); > + spin_unlock(&ice->reg_lock); > if (status & VT1724_IRQ_MTPCM) { > /* > * Multi-track PCM > @@ -2413,8 +2426,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, > return -EIO; > } > > - /* clear interrupts -- otherwise you'll get irq problems later */ > - outb(0, ICEREG1724(ice, IRQMASK)); > + /* MPU_RX and TX irq masks are cleared later dynamically */ > + outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK)); > > /* don't handle FIFO overrun/underruns (just yet), > * since they cause machine lockups >
-- Vedran Miletić
-- Vedran Miletić
-- Vedran Miletić
At Wed, 5 Nov 2008 17:00:55 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Without any patching it works.
vedran@kalopsia:~$ cat /proc/asound/card1/midi0 ICE1724 MIDI
Output 0 Tx bytes : 27753 Mode : native Buffer size : 4096 Avail : 4096 Input 0 Rx bytes : 0
How far do I need to test it? Is this enough?
AFAIK, The MIDI is supposed to work without the patch, but it hangs up on RT kernel. I'd like to check the MIDI is still working after patches.
Takashi
At Wed, 5 Nov 2008 17:19:46 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Cool. Didn't know it was that easy. Also, I didn't expect it to work since file is already patched by alsa-driver compatibility for older kernels, but I was pleasantly surprised: vedran@kalopsia:~/bin/alsa-driver-unstable/alsa-kernel$ patch -p2 < /home/vedran/bin/ice1724-takashi.patch (second one you posted) patching file pci/ice1712/ice1724.c Hunk #1 succeeded at 243 (offset 2 lines). Hunk #2 succeeded at 259 (offset 2 lines). Hunk #3 succeeded at 282 (offset 2 lines). Hunk #4 succeeded at 319 (offset 2 lines). Hunk #5 succeeded at 334 (offset 2 lines). Hunk #6 succeeded at 404 (offset 2 lines). Hunk #7 succeeded at 2458 (offset 32 lines).
MIDI works, no change here. However, mplayer (on both analog and digital) fills dmesg with: [ 1921.595750] ice1724: Too long irq loop, status = 0x20 [ 1921.595775] ice1724: Disabling MPU_TX [ 1921.630993] ice1724: Too long irq loop, status = 0x20 [ 1921.630993] ice1724: Disabling MPU_TX [ 1921.662976] ice1724: Too long irq loop, status = 0x20 [ 1921.662976] ice1724: Disabling MPU_TX [ 1921.694977] ice1724: Too long irq loop, status = 0x20 [ 1921.694977] ice1724: Disabling MPU_TX [ 1921.726998] ice1724: Too long irq loop, status = 0x20 [ 1921.726998] ice1724: Disabling MPU_TX [ 1921.759213] ice1724: Too long irq loop, status = 0x20 [ 1921.759213] ice1724: Disabling MPU_TX [ 1921.791289] ice1724: Too long irq loop, status = 0x20 [ 1921.791289] ice1724: Disabling MPU_TX [ 1921.823276] ice1724: Too long irq loop, status = 0x20 [ 1921.823276] ice1724: Disabling MPU_TX [ 1921.855159] ice1724: Too long irq loop, status = 0x20 [ 1921.855159] ice1724: Disabling MPU_TX
This doesn't happen without patch. Audio works normally.
What about the first patch?
Takashi
Works.
vedran@kalopsia:~$ cat /proc/asound/card1/midi0 ICE1724 MIDI
Output 0 Tx bytes : 20524 Mode : native Buffer size : 4096 Avail : 4096 Input 0 Rx bytes : 0
mplayer also doesn't fill dmesg with anything. Seems better than second one.
However, my card isn't sharing an IRQ or anything. It might be that this is an advantage here?
vedran@kalopsia:~$ lspci -v 00:00.0 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller (rev a2) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 Memory Controller Flags: bus master, 66MHz, fast devsel, latency 0 Capabilities: <access denied>
00:01.0 ISA bridge: nVidia Corporation MCP78S [GeForce 8200] LPC Bridge (rev a2) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 LPC Bridge Flags: bus master, 66MHz, fast devsel, latency 0 I/O ports at 2f00 [size=256]
00:01.1 SMBus: nVidia Corporation MCP78S [GeForce 8200] SMBus (rev a1) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 SMBus Flags: 66MHz, fast devsel, IRQ 7 I/O ports at 2900 [size=64] I/O ports at 2d00 [size=64] I/O ports at 2e00 [size=64] Capabilities: <access denied>
00:01.2 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller (rev a1) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 Memory Controller Flags: 66MHz, fast devsel
00:01.3 Co-processor: nVidia Corporation MCP78S [GeForce 8200] Co-Processor (rev a2) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 Co-Processor Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 10 Memory at f8e80000 (32-bit, non-prefetchable) [size=512K]
00:01.4 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller (rev a1) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 Memory Controller Flags: 66MHz, fast devsel
00:02.0 USB Controller: nVidia Corporation MCP78S [GeForce 8200] OHCI USB 1.1 Controller (rev a1) (prog-if 10 [OHCI]) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 OHCI USB 1.1 Controller Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 23 Memory at f8e7f000 (32-bit, non-prefetchable) [size=4K] Capabilities: <access denied> Kernel driver in use: ohci_hcd Kernel modules: ohci-hcd
00:02.1 USB Controller: nVidia Corporation MCP78S [GeForce 8200] EHCI USB 2.0 Controller (rev a1) (prog-if 20 [EHCI]) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 EHCI USB 2.0 Controller Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 21 Memory at f8e7ec00 (32-bit, non-prefetchable) [size=256] Capabilities: <access denied> Kernel driver in use: ehci_hcd Kernel modules: ehci-hcd
00:04.0 USB Controller: nVidia Corporation MCP78S [GeForce 8200] OHCI USB 1.1 Controller (rev a1) (prog-if 10 [OHCI]) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 OHCI USB 1.1 Controller Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 22 Memory at f8e7d000 (32-bit, non-prefetchable) [size=4K] Capabilities: <access denied> Kernel driver in use: ohci_hcd Kernel modules: ohci-hcd
00:04.1 USB Controller: nVidia Corporation MCP78S [GeForce 8200] EHCI USB 2.0 Controller (rev a1) (prog-if 20 [EHCI]) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 EHCI USB 2.0 Controller Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 20 Memory at f8e7e800 (32-bit, non-prefetchable) [size=256] Capabilities: <access denied> Kernel driver in use: ehci_hcd Kernel modules: ehci-hcd
00:06.0 IDE interface: nVidia Corporation MCP78S [GeForce 8200] IDE (rev a1) (prog-if 8a [Master SecP PriP]) Subsystem: ASRock Incorporation Device 0759 Flags: bus master, 66MHz, fast devsel, latency 0 [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [disabled] [size=8] [virtual] Memory at 000003f0 (type 3, non-prefetchable) [disabled] [size=1] [virtual] Memory at 00000170 (32-bit, non-prefetchable) [disabled] [size=8] [virtual] Memory at 00000370 (type 3, non-prefetchable) [disabled] [size=1] I/O ports at ffa0 [size=16] Capabilities: <access denied> Kernel driver in use: AMD_IDE Kernel modules: ide-pci-generic, amd74xx, ata_generic
00:07.0 Audio device: nVidia Corporation MCP78S [GeForce 8200] High Definition Audio (rev a1) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 High Definition Audio Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 21 Memory at f8e78000 (32-bit, non-prefetchable) [size=16K] Capabilities: <access denied> Kernel driver in use: HDA Intel Kernel modules: snd-hda-intel
00:08.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Bridge (rev a1) (prog-if 01 [Subtractive decode]) Flags: bus master, 66MHz, fast devsel, latency 0 Bus: primary=00, secondary=01, subordinate=01, sec-latency=64 I/O behind bridge: 0000b000-0000bfff Capabilities: <access denied>
00:09.0 IDE interface: nVidia Corporation MCP78S [GeForce 8200] SATA Controller (non-AHCI mode) (rev a2) (prog-if 85 [Master SecO PriO]) Subsystem: ASRock Incorporation Device 0ad0 Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 1276 I/O ports at a480 [size=8] I/O ports at a400 [size=4] I/O ports at a080 [size=8] I/O ports at a000 [size=4] I/O ports at 9c00 [size=16] Memory at f8e76000 (32-bit, non-prefetchable) [size=8K] Capabilities: <access denied> Kernel driver in use: ahci Kernel modules: ide-pci-generic, ahci, ata_generic
00:0a.0 Ethernet controller: nVidia Corporation MCP78S [GeForce 8200] Ethernet (rev a2) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 Ethernet Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 1275 Memory at f8e7c000 (32-bit, non-prefetchable) [size=4K] I/O ports at 9880 [size=8] Memory at f8e7e400 (32-bit, non-prefetchable) [size=256] Memory at f8e7e000 (32-bit, non-prefetchable) [size=16] Capabilities: <access denied> Kernel driver in use: forcedeth Kernel modules: forcedeth
00:0b.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express Bridge (rev a1) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0 Bus: primary=00, secondary=02, subordinate=02, sec-latency=0 I/O behind bridge: 0000c000-0000cfff Memory behind bridge: f8f00000-f9ffffff Prefetchable memory behind bridge: 00000000c6000000-00000000cfffffff Capabilities: <access denied> Kernel modules: shpchp
00:10.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express Bridge (rev a1) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0 Bus: primary=00, secondary=03, subordinate=03, sec-latency=0 I/O behind bridge: 0000d000-0000dfff Memory behind bridge: fa000000-fd7fffff Prefetchable memory behind bridge: 00000000d0000000-00000000dfffffff Capabilities: <access denied> Kernel driver in use: pcieport-driver Kernel modules: shpchp
00:12.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express Bridge (rev a1) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0 Bus: primary=00, secondary=04, subordinate=05, sec-latency=0 I/O behind bridge: 0000e000-0000efff Memory behind bridge: fd800000-febfffff Prefetchable memory behind bridge: 00000000f4000000-00000000f7efffff Capabilities: <access denied> Kernel driver in use: pcieport-driver Kernel modules: shpchp
00:13.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Bridge (rev a1) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0 Bus: primary=00, secondary=06, subordinate=06, sec-latency=0 Prefetchable memory behind bridge: 00000000f7f00000-00000000f7ffffff Capabilities: <access denied> Kernel driver in use: pcieport-driver Kernel modules: shpchp
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration Flags: fast devsel Capabilities: <access denied>
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map Flags: fast devsel
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller Flags: fast devsel
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control Flags: fast devsel Capabilities: <access denied> Kernel driver in use: k8temp Kernel modules: k8temp
01:09.0 Multimedia audio controller: VIA Technologies Inc. VT1720/24 [Envy24PT/HT] PCI Multi-Channel Audio Controller (rev 01) Subsystem: TERRATEC Electronic GmbH PHASE 22 Flags: bus master, medium devsel, latency 64, IRQ 16 I/O ports at bc00 [size=32] I/O ports at b880 [size=128] Capabilities: <access denied> Kernel driver in use: ICE1724 Kernel modules: snd-ice1724
02:00.0 VGA compatible controller: nVidia Corporation GeForce 8200 (rev a2) (prog-if 00 [VGA controller]) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 GeForce 8200 Flags: fast devsel, IRQ 10 Memory at f9000000 (32-bit, non-prefetchable) [disabled] [size=16M] Memory at c8000000 (64-bit, prefetchable) [disabled] [size=128M] Memory at c6000000 (64-bit, prefetchable) [disabled] [size=32M] I/O ports at cc00 [disabled] [size=128] Expansion ROM at f8fe0000 [disabled] [size=128K] Capabilities: <access denied> Kernel modules: nvidiafb
03:00.0 VGA compatible controller: nVidia Corporation GeForce 8500 GT (rev a1) (prog-if 00 [VGA controller]) Subsystem: Micro-Star International Co., Ltd. Device 0960 Flags: bus master, fast devsel, latency 0, IRQ 10 Memory at fc000000 (32-bit, non-prefetchable) [size=16M] Memory at d0000000 (64-bit, prefetchable) [size=256M] Memory at fa000000 (64-bit, non-prefetchable) [size=32M] I/O ports at dc00 [size=128] Expansion ROM at fd7e0000 [disabled] [size=128K] Capabilities: <access denied> Kernel modules: nvidiafb
04:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01) Subsystem: ABIT Computer Corp. AirPace Wi-Fi Flags: bus master, fast devsel, latency 0, IRQ 18 Memory at febf0000 (64-bit, non-prefetchable) [size=64K] Capabilities: <access denied> Kernel driver in use: ath_pci Kernel modules: ath_pci
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 17:19:46 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Cool. Didn't know it was that easy. Also, I didn't expect it to work since file is already patched by alsa-driver compatibility for older kernels, but I was pleasantly surprised: vedran@kalopsia:~/bin/alsa-driver-unstable/alsa-kernel$ patch -p2 < /home/vedran/bin/ice1724-takashi.patch (second one you posted) patching file pci/ice1712/ice1724.c Hunk #1 succeeded at 243 (offset 2 lines). Hunk #2 succeeded at 259 (offset 2 lines). Hunk #3 succeeded at 282 (offset 2 lines). Hunk #4 succeeded at 319 (offset 2 lines). Hunk #5 succeeded at 334 (offset 2 lines). Hunk #6 succeeded at 404 (offset 2 lines). Hunk #7 succeeded at 2458 (offset 32 lines).
MIDI works, no change here. However, mplayer (on both analog and digital) fills dmesg with: [ 1921.595750] ice1724: Too long irq loop, status = 0x20 [ 1921.595775] ice1724: Disabling MPU_TX [ 1921.630993] ice1724: Too long irq loop, status = 0x20 [ 1921.630993] ice1724: Disabling MPU_TX [ 1921.662976] ice1724: Too long irq loop, status = 0x20 [ 1921.662976] ice1724: Disabling MPU_TX [ 1921.694977] ice1724: Too long irq loop, status = 0x20 [ 1921.694977] ice1724: Disabling MPU_TX [ 1921.726998] ice1724: Too long irq loop, status = 0x20 [ 1921.726998] ice1724: Disabling MPU_TX [ 1921.759213] ice1724: Too long irq loop, status = 0x20 [ 1921.759213] ice1724: Disabling MPU_TX [ 1921.791289] ice1724: Too long irq loop, status = 0x20 [ 1921.791289] ice1724: Disabling MPU_TX [ 1921.823276] ice1724: Too long irq loop, status = 0x20 [ 1921.823276] ice1724: Disabling MPU_TX [ 1921.855159] ice1724: Too long irq loop, status = 0x20 [ 1921.855159] ice1724: Disabling MPU_TX
This doesn't happen without patch. Audio works normally.
What about the first patch?
Takashi
Could you stop top-posting? This is hard to follow. Also, please edit the citation appropriately if it gets too long...
At Wed, 5 Nov 2008 17:36:57 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Works.
vedran@kalopsia:~$ cat /proc/asound/card1/midi0 ICE1724 MIDI
Output 0 Tx bytes : 20524 Mode : native Buffer size : 4096 Avail : 4096 Input 0 Rx bytes : 0
mplayer also doesn't fill dmesg with anything. Seems better than second one.
Hm, OK, then we can put the first patch, then improve if possible later.
However, my card isn't sharing an IRQ or anything. It might be that this is an advantage here?
Not quite.
thanks,
Takashi
vedran@kalopsia:~$ lspci -v 00:00.0 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller (rev a2) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 Memory Controller Flags: bus master, 66MHz, fast devsel, latency 0 Capabilities: <access denied>
00:01.0 ISA bridge: nVidia Corporation MCP78S [GeForce 8200] LPC Bridge (rev a2) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 LPC Bridge Flags: bus master, 66MHz, fast devsel, latency 0 I/O ports at 2f00 [size=256]
00:01.1 SMBus: nVidia Corporation MCP78S [GeForce 8200] SMBus (rev a1) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 SMBus Flags: 66MHz, fast devsel, IRQ 7 I/O ports at 2900 [size=64] I/O ports at 2d00 [size=64] I/O ports at 2e00 [size=64] Capabilities: <access denied>
00:01.2 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller (rev a1) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 Memory Controller Flags: 66MHz, fast devsel
00:01.3 Co-processor: nVidia Corporation MCP78S [GeForce 8200] Co-Processor (rev a2) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 Co-Processor Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 10 Memory at f8e80000 (32-bit, non-prefetchable) [size=512K]
00:01.4 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller (rev a1) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 Memory Controller Flags: 66MHz, fast devsel
00:02.0 USB Controller: nVidia Corporation MCP78S [GeForce 8200] OHCI USB 1.1 Controller (rev a1) (prog-if 10 [OHCI]) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 OHCI USB 1.1 Controller Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 23 Memory at f8e7f000 (32-bit, non-prefetchable) [size=4K] Capabilities: <access denied> Kernel driver in use: ohci_hcd Kernel modules: ohci-hcd
00:02.1 USB Controller: nVidia Corporation MCP78S [GeForce 8200] EHCI USB 2.0 Controller (rev a1) (prog-if 20 [EHCI]) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 EHCI USB 2.0 Controller Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 21 Memory at f8e7ec00 (32-bit, non-prefetchable) [size=256] Capabilities: <access denied> Kernel driver in use: ehci_hcd Kernel modules: ehci-hcd
00:04.0 USB Controller: nVidia Corporation MCP78S [GeForce 8200] OHCI USB 1.1 Controller (rev a1) (prog-if 10 [OHCI]) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 OHCI USB 1.1 Controller Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 22 Memory at f8e7d000 (32-bit, non-prefetchable) [size=4K] Capabilities: <access denied> Kernel driver in use: ohci_hcd Kernel modules: ohci-hcd
00:04.1 USB Controller: nVidia Corporation MCP78S [GeForce 8200] EHCI USB 2.0 Controller (rev a1) (prog-if 20 [EHCI]) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 EHCI USB 2.0 Controller Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 20 Memory at f8e7e800 (32-bit, non-prefetchable) [size=256] Capabilities: <access denied> Kernel driver in use: ehci_hcd Kernel modules: ehci-hcd
00:06.0 IDE interface: nVidia Corporation MCP78S [GeForce 8200] IDE (rev a1) (prog-if 8a [Master SecP PriP]) Subsystem: ASRock Incorporation Device 0759 Flags: bus master, 66MHz, fast devsel, latency 0 [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [disabled] [size=8] [virtual] Memory at 000003f0 (type 3, non-prefetchable) [disabled] [size=1] [virtual] Memory at 00000170 (32-bit, non-prefetchable) [disabled] [size=8] [virtual] Memory at 00000370 (type 3, non-prefetchable) [disabled] [size=1] I/O ports at ffa0 [size=16] Capabilities: <access denied> Kernel driver in use: AMD_IDE Kernel modules: ide-pci-generic, amd74xx, ata_generic
00:07.0 Audio device: nVidia Corporation MCP78S [GeForce 8200] High Definition Audio (rev a1) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 High Definition Audio Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 21 Memory at f8e78000 (32-bit, non-prefetchable) [size=16K] Capabilities: <access denied> Kernel driver in use: HDA Intel Kernel modules: snd-hda-intel
00:08.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Bridge (rev a1) (prog-if 01 [Subtractive decode]) Flags: bus master, 66MHz, fast devsel, latency 0 Bus: primary=00, secondary=01, subordinate=01, sec-latency=64 I/O behind bridge: 0000b000-0000bfff Capabilities: <access denied>
00:09.0 IDE interface: nVidia Corporation MCP78S [GeForce 8200] SATA Controller (non-AHCI mode) (rev a2) (prog-if 85 [Master SecO PriO]) Subsystem: ASRock Incorporation Device 0ad0 Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 1276 I/O ports at a480 [size=8] I/O ports at a400 [size=4] I/O ports at a080 [size=8] I/O ports at a000 [size=4] I/O ports at 9c00 [size=16] Memory at f8e76000 (32-bit, non-prefetchable) [size=8K] Capabilities: <access denied> Kernel driver in use: ahci Kernel modules: ide-pci-generic, ahci, ata_generic
00:0a.0 Ethernet controller: nVidia Corporation MCP78S [GeForce 8200] Ethernet (rev a2) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 Ethernet Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 1275 Memory at f8e7c000 (32-bit, non-prefetchable) [size=4K] I/O ports at 9880 [size=8] Memory at f8e7e400 (32-bit, non-prefetchable) [size=256] Memory at f8e7e000 (32-bit, non-prefetchable) [size=16] Capabilities: <access denied> Kernel driver in use: forcedeth Kernel modules: forcedeth
00:0b.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express Bridge (rev a1) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0 Bus: primary=00, secondary=02, subordinate=02, sec-latency=0 I/O behind bridge: 0000c000-0000cfff Memory behind bridge: f8f00000-f9ffffff Prefetchable memory behind bridge: 00000000c6000000-00000000cfffffff Capabilities: <access denied> Kernel modules: shpchp
00:10.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express Bridge (rev a1) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0 Bus: primary=00, secondary=03, subordinate=03, sec-latency=0 I/O behind bridge: 0000d000-0000dfff Memory behind bridge: fa000000-fd7fffff Prefetchable memory behind bridge: 00000000d0000000-00000000dfffffff Capabilities: <access denied> Kernel driver in use: pcieport-driver Kernel modules: shpchp
00:12.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express Bridge (rev a1) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0 Bus: primary=00, secondary=04, subordinate=05, sec-latency=0 I/O behind bridge: 0000e000-0000efff Memory behind bridge: fd800000-febfffff Prefetchable memory behind bridge: 00000000f4000000-00000000f7efffff Capabilities: <access denied> Kernel driver in use: pcieport-driver Kernel modules: shpchp
00:13.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Bridge (rev a1) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0 Bus: primary=00, secondary=06, subordinate=06, sec-latency=0 Prefetchable memory behind bridge: 00000000f7f00000-00000000f7ffffff Capabilities: <access denied> Kernel driver in use: pcieport-driver Kernel modules: shpchp
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration Flags: fast devsel Capabilities: <access denied>
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map Flags: fast devsel
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller Flags: fast devsel
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control Flags: fast devsel Capabilities: <access denied> Kernel driver in use: k8temp Kernel modules: k8temp
01:09.0 Multimedia audio controller: VIA Technologies Inc. VT1720/24 [Envy24PT/HT] PCI Multi-Channel Audio Controller (rev 01) Subsystem: TERRATEC Electronic GmbH PHASE 22 Flags: bus master, medium devsel, latency 64, IRQ 16 I/O ports at bc00 [size=32] I/O ports at b880 [size=128] Capabilities: <access denied> Kernel driver in use: ICE1724 Kernel modules: snd-ice1724
02:00.0 VGA compatible controller: nVidia Corporation GeForce 8200 (rev a2) (prog-if 00 [VGA controller]) Subsystem: ASRock Incorporation K10N78FullHD-hSLI R3.0 GeForce 8200 Flags: fast devsel, IRQ 10 Memory at f9000000 (32-bit, non-prefetchable) [disabled] [size=16M] Memory at c8000000 (64-bit, prefetchable) [disabled] [size=128M] Memory at c6000000 (64-bit, prefetchable) [disabled] [size=32M] I/O ports at cc00 [disabled] [size=128] Expansion ROM at f8fe0000 [disabled] [size=128K] Capabilities: <access denied> Kernel modules: nvidiafb
03:00.0 VGA compatible controller: nVidia Corporation GeForce 8500 GT (rev a1) (prog-if 00 [VGA controller]) Subsystem: Micro-Star International Co., Ltd. Device 0960 Flags: bus master, fast devsel, latency 0, IRQ 10 Memory at fc000000 (32-bit, non-prefetchable) [size=16M] Memory at d0000000 (64-bit, prefetchable) [size=256M] Memory at fa000000 (64-bit, non-prefetchable) [size=32M] I/O ports at dc00 [size=128] Expansion ROM at fd7e0000 [disabled] [size=128K] Capabilities: <access denied> Kernel modules: nvidiafb
04:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01) Subsystem: ABIT Computer Corp. AirPace Wi-Fi Flags: bus master, fast devsel, latency 0, IRQ 18 Memory at febf0000 (64-bit, non-prefetchable) [size=64K] Capabilities: <access denied> Kernel driver in use: ath_pci Kernel modules: ath_pci
2008/11/5 Takashi Iwai tiwai@suse.de:
At Wed, 5 Nov 2008 17:19:46 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Cool. Didn't know it was that easy. Also, I didn't expect it to work since file is already patched by alsa-driver compatibility for older kernels, but I was pleasantly surprised: vedran@kalopsia:~/bin/alsa-driver-unstable/alsa-kernel$ patch -p2 < /home/vedran/bin/ice1724-takashi.patch (second one you posted) patching file pci/ice1712/ice1724.c Hunk #1 succeeded at 243 (offset 2 lines). Hunk #2 succeeded at 259 (offset 2 lines). Hunk #3 succeeded at 282 (offset 2 lines). Hunk #4 succeeded at 319 (offset 2 lines). Hunk #5 succeeded at 334 (offset 2 lines). Hunk #6 succeeded at 404 (offset 2 lines). Hunk #7 succeeded at 2458 (offset 32 lines).
MIDI works, no change here. However, mplayer (on both analog and digital) fills dmesg with: [ 1921.595750] ice1724: Too long irq loop, status = 0x20 [ 1921.595775] ice1724: Disabling MPU_TX [ 1921.630993] ice1724: Too long irq loop, status = 0x20 [ 1921.630993] ice1724: Disabling MPU_TX [ 1921.662976] ice1724: Too long irq loop, status = 0x20 [ 1921.662976] ice1724: Disabling MPU_TX [ 1921.694977] ice1724: Too long irq loop, status = 0x20 [ 1921.694977] ice1724: Disabling MPU_TX [ 1921.726998] ice1724: Too long irq loop, status = 0x20 [ 1921.726998] ice1724: Disabling MPU_TX [ 1921.759213] ice1724: Too long irq loop, status = 0x20 [ 1921.759213] ice1724: Disabling MPU_TX [ 1921.791289] ice1724: Too long irq loop, status = 0x20 [ 1921.791289] ice1724: Disabling MPU_TX [ 1921.823276] ice1724: Too long irq loop, status = 0x20 [ 1921.823276] ice1724: Disabling MPU_TX [ 1921.855159] ice1724: Too long irq loop, status = 0x20 [ 1921.855159] ice1724: Disabling MPU_TX
This doesn't happen without patch. Audio works normally.
What about the first patch?
Takashi
-- Vedran Miletić
At Wed, 05 Nov 2008 17:40:58 +0100, I wrote:
At Wed, 5 Nov 2008 17:36:57 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Works.
vedran@kalopsia:~$ cat /proc/asound/card1/midi0 ICE1724 MIDI
Output 0 Tx bytes : 20524 Mode : native Buffer size : 4096 Avail : 4096 Input 0 Rx bytes : 0
mplayer also doesn't fill dmesg with anything. Seems better than second one.
Hm, OK, then we can put the first patch, then improve if possible later.
I updated git and snapshot now. It'll take some time it's sync'ed, though.
The below is the revised patch to enable/disable the TX irq more dynamically. Give it a try on the top of the new snapshot (where the first fix is already applied).
thanks,
Takashi
At Wed, 05 Nov 2008 17:57:03 +0100, I wrote:
At Wed, 05 Nov 2008 17:40:58 +0100, I wrote:
At Wed, 5 Nov 2008 17:36:57 +0100, =?UTF-8?Q?Vedran_Mileti=C4=87?= wrote:
Works.
vedran@kalopsia:~$ cat /proc/asound/card1/midi0 ICE1724 MIDI
Output 0 Tx bytes : 20524 Mode : native Buffer size : 4096 Avail : 4096 Input 0 Rx bytes : 0
mplayer also doesn't fill dmesg with anything. Seems better than second one.
Hm, OK, then we can put the first patch, then improve if possible later.
I updated git and snapshot now. It'll take some time it's sync'ed, though.
The below is the revised patch to enable/disable the TX irq more dynamically. Give it a try on the top of the new snapshot (where the first fix is already applied).
Doh, I forgot to attach the patch. The below is the one.
Please, if anyone can test it, let me know whether it works. This would be nice to have in the next kernel.
thanks,
Takashi
===
From 33f96ee2c14b256dfe3a9cfadc6385c72fbe80da Mon Sep 17 00:00:00 2001 From: Takashi Iwai tiwai@suse.de Date: Wed, 12 Nov 2008 16:42:44 +0100 Subject: [PATCH] ALSA: ice1724 - Dynamic MIDI TX irq control
MIDI_TX IRQ seems always pending when any bytes on FIFO is available. Thus, it's better to enable MPU_TX only when any bytres are really stored in the substream, and disables immediately when the queue becomes empty.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ice1712/ice1724.c | 43 +++++++++++++++++++++++++++---------------- 1 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 0dfa054..009601b 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -241,6 +241,8 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) struct snd_rawmidi_substream, list); }
+static void enable_midi_irq(struct snd_ice1712 *ice, u8 flag, int enable); + static void vt1724_midi_write(struct snd_ice1712 *ice) { struct snd_rawmidi_substream *s; @@ -254,6 +256,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) for (i = 0; i < count; ++i) outb(buffer[i], ICEREG1724(ice, MPU_DATA)); } + /* mask irq when all bytes have been transmitted. + * enabled again in output_trigger when the new data comes in. + */ + enable_midi_irq(ice, VT1724_IRQ_MPU_TX, + !snd_rawmidi_transmit_empty(s)); }
static void vt1724_midi_read(struct snd_ice1712 *ice) @@ -272,31 +279,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) } }
-static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, - u8 flag, int enable) +/* call with ice->reg_lock */ +static void enable_midi_irq(struct snd_ice1712 *ice, u8 flag, int enable) { - struct snd_ice1712 *ice = substream->rmidi->private_data; - u8 mask; - - spin_lock_irq(&ice->reg_lock); - mask = inb(ICEREG1724(ice, IRQMASK)); + u8 mask = inb(ICEREG1724(ice, IRQMASK)); if (enable) mask &= ~flag; else mask |= flag; outb(mask, ICEREG1724(ice, IRQMASK)); +} + +static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, + u8 flag, int enable) +{ + struct snd_ice1712 *ice = substream->rmidi->private_data; + + spin_lock_irq(&ice->reg_lock); + enable_midi_irq(ice, flag, enable); spin_unlock_irq(&ice->reg_lock); }
static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) { - vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); return 0; }
static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) { - vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); return 0; }
@@ -311,6 +321,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) vt1724_midi_write(ice); } else { ice->midi_output = 0; + enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); } spin_unlock_irqrestore(&ice->reg_lock, flags); } @@ -320,6 +331,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) struct snd_ice1712 *ice = s->rmidi->private_data; unsigned long timeout;
+ vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); /* 32 bytes should be transmitted in less than about 12 ms */ timeout = jiffies + msecs_to_jiffies(15); do { @@ -389,24 +401,24 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status &= status_mask; if (status == 0) break; + spin_lock(&ice->reg_lock); if (++timeout > 10) { status = inb(ICEREG1724(ice, IRQSTAT)); printk(KERN_ERR "ice1724: Too long irq loop, " "status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); - outb(inb(ICEREG1724(ice, IRQMASK)) | - VT1724_IRQ_MPU_TX, - ICEREG1724(ice, IRQMASK)); + enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); } + spin_unlock(&ice->reg_lock); break; } handled = 1; if (status & VT1724_IRQ_MPU_TX) { - spin_lock(&ice->reg_lock); if (ice->midi_output) vt1724_midi_write(ice); - spin_unlock(&ice->reg_lock); + else + enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); /* Due to mysterical reasons, MPU_TX is always * generated (and can't be cleared) when a PCM * playback is going. So let's ignore at the @@ -415,15 +427,14 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) status_mask &= ~VT1724_IRQ_MPU_TX; } if (status & VT1724_IRQ_MPU_RX) { - spin_lock(&ice->reg_lock); if (ice->midi_input) vt1724_midi_read(ice); else vt1724_midi_clear_rx(ice); - spin_unlock(&ice->reg_lock); } /* ack MPU irq */ outb(status, ICEREG1724(ice, IRQSTAT)); + spin_unlock(&ice->reg_lock); if (status & VT1724_IRQ_MTPCM) { /* * Multi-track PCM
participants (3)
-
Karsten Wiese
-
Takashi Iwai
-
Vedran Miletić