From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4329DC433DB for ; Sun, 10 Jan 2021 17:23:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1521E22B2C for ; Sun, 10 Jan 2021 17:23:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726267AbhAJRXc (ORCPT ); Sun, 10 Jan 2021 12:23:32 -0500 Received: from mx2.suse.de ([195.135.220.15]:40182 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726228AbhAJRXc (ORCPT ); Sun, 10 Jan 2021 12:23:32 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6499EABC4; Sun, 10 Jan 2021 17:22:50 +0000 (UTC) Date: Sun, 10 Jan 2021 18:22:50 +0100 Message-ID: From: Takashi Iwai To: Lauri Kasanen Cc: linux-mips@vger.kernel.org, tsbogend@alpha.franken.de, perex@perex.cz Subject: Re: [PATCH 5/6 v2] sound: Add n64 driver In-Reply-To: <20210110190332.8a818e931975f02b8f3d3881@gmx.com> References: <20210108103513.336e6eb9ad323feff6758e20@gmx.com> <20210109092303.b9a2a2f678a5d1b19b7f27f3@gmx.com> <20210109194601.f94ca38b2b99ddeb15705993@gmx.com> <20210110091536.b3bc5dce2ef9d6c94d3eb873@gmx.com> <20210110190332.8a818e931975f02b8f3d3881@gmx.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On Sun, 10 Jan 2021 18:03:32 +0100, Lauri Kasanen wrote: > > On Sun, 10 Jan 2021 11:24:22 +0100 > Takashi Iwai wrote: > > > > At first there was no nextpos, and _pointer() always reported pos. This > > > didn't work, the core played through the audio at chipmunk speed. So > > > there must be more that I don't understand here. > > > > Try to set the periods_min=2 and the integer periods hw constraint at > > first, and change the pointer callback to return nextpos. Also, at > > the push function, set runtime->delay = period_size as well. > > When I do all this, it still causes the chipmunk speed. Several seconds > of audio gets played in 0.3s or so. Sorry if this is taking too much of > your time, I'm a bit lost here at what the alsa core is expecting. > > Printks show the following repeats: > start, period size 1024 > push, bool irq=0 > irq fired > push, bool irq=1 > pointer at 8192 > stop Hm, is the above about the result with the pointer callback returning pos, not nextpos? If so, > start, period size 1024 > push, bool irq=0 At this moment, nextpos is 1024, and it should take some time until > irq fired ... this IRQ is triggered; it must be the period time. Was the reported timing as expected? > push, bool irq=1 > pointer at 8192 If it's the first IRQ, isn't the nextpos 2048? > stop It's stopped likely because the position reported the driver is beyond the data size the application filled (XRUN). > It stops and starts again for some reason. This does not happen in the > current pos/nextpos implementation. > > > > - the DMA unit has errata if (start + len) & 0x3fff == 0x2000, this > > > must never happen > > > > Ditto. > > Can it really handle a constraint this complex? That'd be impressive. > It'd remove the memcpy need if so. The hw constraint can be just a function that filters the min/max value the driver may accept, so such a rule is possible. > > > - the audio IRQ is not a timer, it fires when the card's internal > > > buffers are empty and need immediate refill > > > > It's the current implementation, right? > > Yes, but I was wondering if a different setup would work better. The > alsa setup is a bit confusing to me still. The implementation became a bit complex due to the hardware restriction, yeah. thanks, Takashi