Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2062228rwb; Wed, 5 Oct 2022 08:30:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JIcFm/LUHcqPZpzbdahgGMqr4MqAbHZQY55z6hxw4Vx2Mg3wrKJR0xEWs695pWDc/EvMX X-Received: by 2002:a05:6402:3890:b0:451:ef52:8f9e with SMTP id fd16-20020a056402389000b00451ef528f9emr295493edb.107.1664983852819; Wed, 05 Oct 2022 08:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664983852; cv=none; d=google.com; s=arc-20160816; b=zVXmYbyHOTL6OKj+eEzP/5RCXQeaY/NX3rXImnehbAmMu+avO9kaGsCEQqKwr2RMcW VU+OJWN5D6nb9P1PmeYtcECsRpitYdxRz121NBVIbdGc/dzWK4TBz6VMhHQIdD7EJy5+ s3YO4imSJ/F95UseRCP6vTTWPHuM5JLqVsqudBJv7XZX0KDTf/1TwltQ7NCSyWsmog5s fVNvH/TjNND8tVzcrJsk1nMeM4WNJYc04lynM2s6pJ7nOOUnh75s9K1whh20qisMvd+F 1mzIDkxThxkgln8AX/169yAGG21NC7N2BUV179Ef+mfldpNIvvL3aRdKEWB84PgiuIa8 v0QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Cod5jumVs6bGHb9R4/W8SPmgVaq+oJncAyynB6rOjYQ=; b=QuTun514YyBUQnki3OVrt2kRidXdW/GmKCxvz7zOTbDI3TEJxpWxKlBjm0Wf48COWH zwHqVEG+sIwRqDG+i737nJOFudWqfkglGR1e+If6wOzj2D2XY8fLrcHv3AUhGo9llJyq J+b35mTDgxGSbj+TcrXW1HLL9sdgCvllZBeV/2+W0jpxEL/uM76bAcVmhA6s8LE1O5PC t2KDfCOThKnlKkUHtg0BinSpm3td73rAPIkbImNccwBa27v3iHMmt2ZyD/3VuVFShXhD GZLT73zq5WBguFeBdI+JEo15l4p66wf7QWecdlIrg7FlydVnT60EhITFJbmx9LuKMkxw RblQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DoWiCKfY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f25-20020a50ee99000000b004587b75d725si12919052edr.47.2022.10.05.08.30.23; Wed, 05 Oct 2022 08:30:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DoWiCKfY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230113AbiJEOr3 (ORCPT + 99 others); Wed, 5 Oct 2022 10:47:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbiJEOr1 (ORCPT ); Wed, 5 Oct 2022 10:47:27 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 553887822A; Wed, 5 Oct 2022 07:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664981246; x=1696517246; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=dNQBsbtOaMCABt+PbDrwoClydLLiJCNOgq0glzVcLcs=; b=DoWiCKfYJLDo9rOZCVhI8KFcFxjPBx/Pg3wV4eDZcnatebYyKVGYg31w I5PO+3ctrIOFJU/uXubTSBww4MrYpZKCofQ8CVW9Bn5mG1qIl36xh4JCF Cab3TV0Dwj0iZeH/gte0RcQRZATKW8TsP8zN9I0lzHhcK2TpSB7JijK9O NoohXZkAnOC0l3uOBy+LiRP+Jk3p2lsCMrmTYzPaYwFnS8TFFaK1TWbeo PhKOjm578N0KIjIMAJrquYFHQvCLx3Nu49VmLOnd/z/iXNj936mQcKNYJ oS73ut92oA0yxABFpNl+VvnQ7zo05uThL7P7++Y0bEr5A4EQaQoIpPSAw Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="282891911" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="282891911" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 07:47:26 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="766747457" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="766747457" Received: from aslawinx-mobl.ger.corp.intel.com (HELO [10.99.241.167]) ([10.99.241.167]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 07:47:23 -0700 Message-ID: Date: Wed, 5 Oct 2022 16:47:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH v2 2/4] ALSA: hda: Rework snd_hdac_stream_reset() to use macros Content-Language: en-US To: Jon Hunter , Takashi Iwai Cc: alsa-devel@alsa-project.org, Cezary Rojewski , Takashi Iwai , linux-kernel@vger.kernel.org, Pierre-Louis Bossart , "linux-tegra@vger.kernel.org" , Mohan Kumar D 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> <87lepugy85.wl-tiwai@suse.de> From: =?UTF-8?Q?Amadeusz_S=c5=82awi=c5=84ski?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/5/2022 4:26 PM, Jon Hunter wrote: > > > On 05/10/2022 15:07, Takashi Iwai wrote: >> 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. > > > I wondered the same and tried that, but still not working. > > Jon > Well in worse case we can revert the patch in question, but I would like to get it working... Maybe also try to raise timeout to 1000, as what original code called timeout, was actually number of retries? So 300 * udelay(3) which is more or less 900us, so we can round it up for test? I mean, something like: --- a/sound/hda/hdac_stream.c +++ b/sound/hda/hdac_stream.c @@ -176,7 +176,7 @@ void snd_hdac_stream_reset(struct hdac_stream *azx_dev) snd_hdac_stream_updateb(azx_dev, SD_CTL, 0, SD_CTL_STREAM_RESET); /* wait for hardware to report that the stream entered reset */ - snd_hdac_stream_readb_poll(azx_dev, SD_CTL, val, (val & SD_CTL_STREAM_RESET), 3, 300); + snd_hdac_stream_readb_poll(azx_dev, SD_CTL, val, (val & SD_CTL_STREAM_RESET), 3, 1000); if (azx_dev->bus->dma_stop_delay && dma_run_state) udelay(azx_dev->bus->dma_stop_delay); @@ -184,7 +184,7 @@ void snd_hdac_stream_reset(struct hdac_stream *azx_dev) snd_hdac_stream_updateb(azx_dev, SD_CTL, SD_CTL_STREAM_RESET, 0); /* wait for hardware to report that the stream is out of reset */ - snd_hdac_stream_readb_poll(azx_dev, SD_CTL, val, !(val & SD_CTL_STREAM_RESET), 3, 300); + snd_hdac_stream_readb_poll(azx_dev, SD_CTL, val, !(val & SD_CTL_STREAM_RESET), 3, 1000); /* reset first position - may not be synced with hw at this time */ if (azx_dev->posbuf) in addition to Takashi suggestion?