From patchwork Sun Mar 24 11:19:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Rebe?= X-Patchwork-Id: 10867417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D727925 for ; Sun, 24 Mar 2019 11:21:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D82F29475 for ; Sun, 24 Mar 2019 11:21:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7146B29472; Sun, 24 Mar 2019 11:21:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D987A29472 for ; Sun, 24 Mar 2019 11:21:03 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6B9CE85F; Sun, 24 Mar 2019 12:20:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6B9CE85F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1553426461; bh=D0jvVftMibDYQU+/eydodvvs5kDDJa2WWLV9wdu2rNI=; h=From:In-Reply-To:Date:References:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BKtj4ODlqruibnK4oJGjpDRUH6xP/QVH2JmkU7hxcBq/UAD5dlX9bBfh42p3FmxCN FMqn39uML53jf/fnLWtnqcuORMp/ulEyQltmG//NonMgwVHyFHba6SETuhfjewkaBx PPWlHl3oFXiEq6YMd4qC0H+8pD7hS1oXGMS98H1w= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C5CBEF80C18; Sun, 24 Mar 2019 12:20:10 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id E7DE5F8961A; Sun, 24 Mar 2019 12:20:08 +0100 (CET) Received: from mx.exactcode.de (mx.exactcode.de [144.76.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 84384F80C17 for ; Sun, 24 Mar 2019 12:20:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 84384F80C17 Authentication-Results: alsa1.perex.cz; dkim=fail reason="key not found in DNS" (0-bit key) header.d=exactcode.de header.i=@exactcode.de header.b="TMYmKg8u" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=exactcode.de; s=x; h=To:References:Message-Id:Content-Transfer-Encoding:Cc:Date:In-Reply-To:From:Subject:Mime-Version:Content-Type; bh=1TEuGLOhYx6eDk1CWoJZRDB9t6jGkoRPRZu875L/7oQ=; b=TMYmKg8u/oJto6TEXBVZH/DexWX3Q4UEhF72EVjEHNUHT1TiZVngtCaOVYbKhNJ8SpLYSzuTZCZ7fxm+44SImF4TxvG7Iy9eFDewLwJ6d7xdReZ80bAV7Y873zqRBW+a3mPawGzzEj7bGCMuf5238ug0MYmtEx71p6QRl7a131I=; Received: from exactco.de ([90.187.5.221]) by mx.exactcode.de with esmtp (Exim 4.82) (envelope-from ) id 1h81Ae-0008NO-LE; Sun, 24 Mar 2019 11:20:08 +0000 Received: from 54.203.140.77.rev.sfr.net ([77.140.203.54] helo=[192.168.0.24]) by exactco.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.54) id 1h81DF-00082l-VA; Sun, 24 Mar 2019 11:23:00 +0000 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) From: =?windows-1252?q?Ren=E9_Rebe?= In-Reply-To: <3E5368DD-5DF4-48A8-A2AF-C19E5C473C8E@exactcode.de> Date: Sun, 24 Mar 2019 12:19:49 +0100 Message-Id: <987F1B5F-5A22-4197-86F1-C48CEF47F0D2@exactcode.de> References: <20170511210925.18208-1-tiwai@suse.de> <20170511210925.18208-17-tiwai@suse.de> <29B2CB39-BCFF-4A04-9406-80059409BDEE@exactcode.de> <3E5368DD-5DF4-48A8-A2AF-C19E5C473C8E@exactcode.de> To: Takashi Iwai X-Mailer: Apple Mail (2.1878.6) Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH RFC] ALSA: rme32: fix interrupt ack for me X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hey, On 02 Mar 2019, at 18:19, René Rebe wrote: > Hi Takashi, > > On 18 Jul 2018, at 12:56, Takashi Iwai wrote: > >>> to have another digital audio i/o card for our studio / office, I got a pair of RME32 the other week from ebay. (mostly as reference to implement ADAT for the RAD1 Sgi/Octane ALSA driver, …) >>> >>> Unfortunately they do not work with Linux. They are recognised and all the usual devices and /proc/… entries show up, however, the hardware pointer does not move during playback or capture no matter what clock source I choose. >>> I tried attaching coax s/pdif as well as an 8-channel Behringer Ultragain ADAT source w/ clock. >> >> Does the /proc/asound/card*/rme32 entry show the right setup? >> RME32 seems to have only few registers, and it behaves differently for >> read and write. Maybe you should try to watch the register 0x20000. >> The hwptr is the LSB 33 bits. > > thank you again for your reply, and I finally took a deep breath to "shortly" > take a closer look at this again. So with current linux-kernel :HEAD nothing > has changed, and I get one IRQ when the playback starts. > > As I do not have the spec I did a quick hack and commented out the IRQ > acknowledge around rme32.c line 829: > > - writel(0, rme32->iobase + RME32_IO_CONFIRM_ACTION_IRQ); > > surprisingly this “works” in that I have more than the first frame coming out of > the optical fibre, aka quite constant running pcm stream. > > "Quite constant” because I think I sometimes (rarely) here some samples > getting lost, probably because the IRQ keeps firing as it was not acknowledged. > However, I’m surprised this works 99%ish anyway. > > Of course the questions is now to actually properly fix this, as acknowledging > this IRQ somehow makes the card stop entirely, I guess, somehow? At least > that is how it looks like. Maybe you have an idea? Maybe some ALSA stream > helper refactoring broke something a decade ago? > > I should probably also mention that this works with aplay, while with sox’s > “play” this hack is somehow producing constant under-run’s: > > In:85.6% 00:03:18.02 [00:00:33.35] Out:8.73M [!=====|=====!] Hd:0.0 Clip:0 play WARN alsa: under-run > play WARN alsa: under-run > play WARN alsa: under-run > > which might be an indication of some stream pointer helper glue not being wired up correctly anymore (I tested some seriously old version the last time, like 2.6.29’ish, so this might be broken since over a decade or so already)? > > Thanks again for any tips, as otherwise I might spend many more hours trying to understand the FPGA and ALSA API. So as the card sort of works in Windows, https://www.youtube.com/watch?v=dxMH3MMyKZ4 I spent some more time finding a workaround. https://www.youtube.com/watch?v=78-JxDzbHX8 Writing something else then 0 to the interrupt acknowledge register keeps the stream running. Writing 0xffffffff causes the stream to corrupt. So I thought maybe this FPGA bitstream copies this value into the command register, and writing that register copy at least playback work for me now. Capture does still not work, but that is probably a story to be continued another month: In case this stupid Mail.app causes white space damages: https://svn.exactcode.de/t2/trunk/package/base/linux/rme32-hothack.patch PS: as per the above 3h video I read the disassembly and confirmed the value is written into the RME32_IO_CONFIRM_ACTION_IRQ MMMIO location. René --- linux-4.20/sound/pci/rme32.c.vanilla 2019-03-03 15:09:34.485653177 +0000 +++ linux-4.20/sound/pci/rme32.c 2019-03-03 15:09:51.077653422 +0000 @@ -863,7 +863,7 @@ if (rme32->playback_substream) { snd_pcm_period_elapsed(rme32->playback_substream); } - writel(0, rme32->iobase + RME32_IO_CONFIRM_ACTION_IRQ); + writel(rme32->wcreg, rme32->iobase + RME32_IO_CONFIRM_ACTION_IRQ); } return IRQ_HANDLED;