Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Hofman <pavel.hofman@insite.cz>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: MIDI on ice1724 - long delays
Date: Thu, 24 Apr 2008 22:47:54 +0200	[thread overview]
Message-ID: <4810F1FA.4020300@insite.cz> (raw)
In-Reply-To: <s5hod7zb4j7.wl%tiwai@suse.de>

[-- Attachment #1: Type: text/plain, Size: 3051 bytes --]

Takashi Iwai wrote:
> At Wed, 23 Apr 2008 22:19:04 +0200, Pavel Hofman wrote:
>> Pavel Hofman wrote:
>>> Takashi Iwai wrote:
>>>> At Tue, 22 Apr 2008 22:23:55 +0200, Pavel Hofman wrote:
>>>>> Hi,
>>>>> 
>>> ...........
>>>>> After the playback stops, the interrupts are gone too. It
>>>>> seems as if the playback interrupt initiates the MPU TX
>>>>> interrupt.
>>>>> 
>>>>> If we could avoid generating the MPU TX interrupt during
>>>>> regular playback, I believe the major problem would be
>>>>> resolved.
>>>>> 
>>>>> Even if I mask the interrupts (CCS01) and do not explicitly
>>>>> unmask them (according to proc ice1724 the CCS01 register
>>>>> stays at 0xa0), the interrupt gets generated.
>>>> OK, then the simplest way would be to just ignore the TX bit at
>>>> the second or later check.
>>>> 
>>>> How about the patch below?
>>> Takashi, thanks for the hack idea. The overhead is just one more
>>> loop which is nothing. I will test it and post details of further
>>> problems (there is a bunch of them :) )
>>> 
>> Hi,
>> 
>> The hack works fine, I am finally getting no CPU burning during
>> playback and  MIDI input/output.
> 
> Thanks for checking.  The fixed patches are on HG tree now. Please
> sync your tree.

Takashi, the patch you put into HG was not the one I sent you, but sort
of the original one that I said did not work.

pavel@nahore:~$ amidi -p hw:0 -d
ALSA lib rawmidi_hw.c:233:(snd_rawmidi_hw_open) open /dev/snd/midiC0D0
failed: Input/output error
cannot open port "hw:0": Input/output error

  amidi -p hw:0 -S
F0411042110C000000000074FF0411042110C000000000074F7F0411042110C000000000\
074F7F0411042110C0F0411042110C000000000074FF0411042110C000000000074F7F041\
1042110C000000000074F7F0411042110C0
ALSA lib rawmidi_hw.c:233:(snd_rawmidi_hw_open) open /dev/snd/midiC0D0
failed: Input/output error
cannot open port "hw:0": Input/output error

I do not know the reason for MPU401_INFO_NO_ACK. You removed it from the
original patch, but without it I always get the input/output error.


>> ................

> So, now it's a problem of MIDI "input", if I understand correctly? 
> What we need to check at first is whether the MPU_RX irq is issued at
>  the correct timing.  If not, check whether MPU watermarks 
> (MPU_FIFO_WM, CCS0E).  According to the datasheet, the values are 0 
> for both RX and TX.

MPU_RX irq did not get fired at all, even though the IRQ mask register 
CCS01 was 0x00, i.e. all interrupts enabled. I enabled the watermarks 
and that did the trick :) MPU_RX gets fired now, the delays are gone and 
Qsynth plays find with MIDI from USB or ice1724 input. It still feels as 
if midi from ice1724 has a little bit higher latency but I do not think 
we can do anything about it (plus it may just be my subjective feeling).

I am enclosing a patch to current HG which does not produce errors and 
puts HG to the functionality I have now. MIDI input works correctly. 
MIDI output is not physically tested, I only checked that 
snd_vt1724_mpu401_write gets called with reasonable data.

Thanks,

Pavel.




[-- Attachment #2: mpu401-v3.diff --]
[-- Type: text/x-patch, Size: 1891 bytes --]

diff -r cde01a191e6e drivers/mpu401/mpu401_uart.c
--- a/drivers/mpu401/mpu401_uart.c	Thu Apr 24 15:11:29 2008 +0200
+++ b/drivers/mpu401/mpu401_uart.c	Thu Apr 24 22:17:01 2008 +0200
@@ -243,7 +243,7 @@ static int snd_mpu401_uart_cmd(struct sn
 #endif
 	}
 	mpu->write(mpu, cmd, MPU401C(mpu));
-	if (ack) {
+	if (ack && !(mpu->info_flags & MPU401_INFO_NO_ACK)) {
 		ok = 0;
 		timeout = 10000;
 		while (!ok && timeout-- > 0) {
diff -r cde01a191e6e include/mpu401.h
--- a/include/mpu401.h	Thu Apr 24 15:11:29 2008 +0200
+++ b/include/mpu401.h	Thu Apr 24 22:17:01 2008 +0200
@@ -50,6 +50,7 @@
 #define MPU401_INFO_INTEGRATED	(1 << 2)	/* integrated h/w port */
 #define MPU401_INFO_MMIO	(1 << 3)	/* MMIO access */
 #define MPU401_INFO_TX_IRQ	(1 << 4)	/* independent TX irq */
+#define MPU401_INFO_NO_ACK	(1 << 6)	/* No ACK cmd needed */
 
 #define MPU401_MODE_BIT_INPUT		0
 #define MPU401_MODE_BIT_OUTPUT		1
diff -r cde01a191e6e pci/ice1712/ice1724.c
--- a/pci/ice1712/ice1724.c	Thu Apr 24 15:11:29 2008 +0200
+++ b/pci/ice1712/ice1724.c	Thu Apr 24 22:17:01 2008 +0200
@@ -2429,7 +2429,10 @@ static int __devinit snd_vt1724_probe(st
 			if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712,
 						       ICEREG1724(ice, MPU_CTRL),
 						       (MPU401_INFO_INTEGRATED |
-							MPU401_INFO_TX_IRQ),
+							MPU401_INFO_NO_ACK |
+							MPU401_INFO_TX_IRQ |
+							MPU401_INFO_INPUT |
+							MPU401_INFO_OUTPUT),
 						       ice->irq, 0,
 						       &ice->rmidi[0])) < 0) {
 				snd_card_free(card);
@@ -2442,12 +2445,10 @@ static int __devinit snd_vt1724_probe(st
 			outb(inb(ICEREG1724(ice, IRQMASK)) &
 			     ~(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX),
 			     ICEREG1724(ice, IRQMASK));
-#if 0 /* for testing */
 			/* set watermarks */
 			outb(VT1724_MPU_RX_FIFO | 0x1,
 			     ICEREG1724(ice, MPU_FIFO_WM));
 			outb(0x1, ICEREG1724(ice, MPU_FIFO_WM));
-#endif
 		}
 	}
 

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2008-04-24 20:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-22 20:23 MIDI on ice1724 - preliminary findings and questions Pavel Hofman
2008-04-23 10:05 ` Takashi Iwai
2008-04-23 11:08   ` Pavel Hofman
2008-04-23 20:19     ` MIDI on ice1724 - long delays Pavel Hofman
2008-04-24 16:29       ` Takashi Iwai
2008-04-24 20:47         ` Pavel Hofman [this message]
2008-04-25  6:22           ` Takashi Iwai
2008-04-25  7:06             ` MIDI on ice1724 - fixing HG Pavel Hofman
2008-04-25  7:10               ` Takashi Iwai
2008-04-25  7:25                 ` Pavel Hofman
2008-04-30 20:07                 ` MIDI on ice1724 - real-time kernel problem Pavel Hofman
2008-05-02 12:43                   ` Takashi Iwai
2008-05-03 19:12                     ` Pavel Hofman
2008-05-07 10:25                       ` Takashi Iwai
2008-05-08 19:35                         ` Pavel Hofman
2008-05-15  7:21                           ` Clemens Ladisch
2008-05-15  9:00                             ` Takashi Iwai
2008-05-18 20:02                             ` PATCH - MIDI on ice1724 - real-time kernel problem SOLVED Pavel Hofman
2008-05-20  8:44                               ` Clemens Ladisch
2008-05-20 19:15                                 ` Pavel Hofman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4810F1FA.4020300@insite.cz \
    --to=pavel.hofman@insite.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox