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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B03E6C433F5 for ; Wed, 5 Oct 2022 14:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230118AbiJEOH6 (ORCPT ); Wed, 5 Oct 2022 10:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbiJEOH5 (ORCPT ); Wed, 5 Oct 2022 10:07:57 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62FFF76773; Wed, 5 Oct 2022 07:07:56 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 06B771F45F; Wed, 5 Oct 2022 14:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1664978875; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XioUhwCBBtQwLWJU+hANZWRRbVnnSiuRtPmjADjh+pc=; b=TWzKJkgsjO+FA/Gx2PrIWWljAqlLGw07E31yArWdouhRFFJiP0UfhdDVKkhlfPv1gMobIM dPlRttIaz3JYhXQ+tuq8X+Lyj0lR5RTLagwjqwBUptVitAJAyxZcIdz322dwVCGJ4BsdvJ Vjo/+zPWtzR4MbvXTAFL9+7DVVrlcJY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1664978875; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XioUhwCBBtQwLWJU+hANZWRRbVnnSiuRtPmjADjh+pc=; b=HYIWH8O+uvTINcwhF3VKPCGHEztfFKymkcgIBSuSsziKIoQp7RIbHvbSqpZIkZQwr/bmhU uSi/UaPshUWUd1DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B4A8613345; Wed, 5 Oct 2022 14:07:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Q8dSK7qPPWNtHAAAMHmgww (envelope-from ); Wed, 05 Oct 2022 14:07:54 +0000 Date: Wed, 05 Oct 2022 16:07:54 +0200 Message-ID: <87lepugy85.wl-tiwai@suse.de> From: Takashi Iwai To: Jon Hunter Cc: Amadeusz =?ISO-8859-2?Q?S=B3awi=F1ski?= , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Cezary Rojewski , Pierre-Louis Bossart , Jaroslav Kysela , "linux-tegra@vger.kernel.org" , Mohan Kumar D Subject: Re: [PATCH v2 2/4] ALSA: hda: Rework snd_hdac_stream_reset() to use macros In-Reply-To: <9677f39a-5297-bb1c-d4e3-62484ec1cf25@nvidia.com> References: <20220818141517.109280-1-amadeuszx.slawinski@linux.intel.com> <20220818141517.109280-3-amadeuszx.slawinski@linux.intel.com> <657d2418-0c3e-296f-8f4a-dc10ced2dffe@nvidia.com> <87a66av4gk.wl-tiwai@suse.de> <9677f39a-5297-bb1c-d4e3-62484ec1cf25@nvidia.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org On Wed, 05 Oct 2022 15:52:01 +0200, Jon Hunter wrote: > > > On 05/10/2022 13:29, Takashi Iwai wrote: > > ... > > >> HDA playback is failing on -next for various Tegra boards. Bisect is > >> point to this commit and reverting it fixes the problem. I was a bit > >> puzzled why this change is causing a problem, but looking closer there > >> is a difference between the previous code that was calling > >> snd_hdac_stream_readb() and the new code that is calling > >> snd_hdac_stream_readb_poll(). The function snd_hdac_stream_readb() > >> calls snd_hdac_aligned_mmio() is see if the device has an aligned MMIO > >> which Tegra does and then would call snd_hdac_aligned_read(). However, > >> now the code always call readb() and this is breaking Tegra. > >> > >> So it is either necessary to update snd_hdac_stream_readb_poll() to > >> handle this or revert this change. > > > > Does the patch below work? > > > > > > thanks, > > > > Takashi > > > > -- 8< -- > > --- a/include/sound/hdaudio.h > > +++ b/include/sound/hdaudio.h > > @@ -592,8 +592,8 @@ int snd_hdac_get_stream_stripe_ctl(struct hdac_bus *bus, > > #define snd_hdac_stream_readb(dev, reg) \ > > snd_hdac_reg_readb((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg) > > #define snd_hdac_stream_readb_poll(dev, reg, val, cond, delay_us, timeout_us) \ > > - readb_poll_timeout((dev)->sd_addr + AZX_REG_ ## reg, val, cond, \ > > - delay_us, timeout_us) > > + read_poll_timeout(snd_hdac_reg_readb, val, cond, delay_us, timeout_us,\ > > + false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg) > > #define snd_hdac_stream_readl_poll(dev, reg, val, cond, delay_us, timeout_us) \ > > readl_poll_timeout((dev)->sd_addr + AZX_REG_ ## reg, val, cond, \ > > delay_us, timeout_us) > > > Amazingly it does not work. I would have thought that would, but it > does not. I am a bit puzzled by that? Interesting, it must be a subtle difference. What about passing true? It seems that the original code has the udelay(3) before the loop. Takashi -- 8< -- --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -592,8 +592,8 @@ int snd_hdac_get_stream_stripe_ctl(struct hdac_bus *bus, #define snd_hdac_stream_readb(dev, reg) \ snd_hdac_reg_readb((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg) #define snd_hdac_stream_readb_poll(dev, reg, val, cond, delay_us, timeout_us) \ - readb_poll_timeout((dev)->sd_addr + AZX_REG_ ## reg, val, cond, \ - delay_us, timeout_us) + read_poll_timeout(snd_hdac_reg_readb, val, cond, delay_us, timeout_us,\ + true, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg) #define snd_hdac_stream_readl_poll(dev, reg, val, cond, delay_us, timeout_us) \ readl_poll_timeout((dev)->sd_addr + AZX_REG_ ## reg, val, cond, \ delay_us, timeout_us)