From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: Takashi Iwai <tiwai@suse.com>, alsa-devel@alsa-project.org
Cc: Cezary Rojewski <cezary.rojewski@intel.com>,
linux-kernel@vger.kernel.org,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: Re: [PATCH 2/4] ALSA: hda: Rework snd_hdac_stream_reset() to use macros
Date: Wed, 17 Aug 2022 15:20:41 +0200 [thread overview]
Message-ID: <2888a74f-eb9c-cfef-1b1f-8bd81ab4bd1a@linux.intel.com> (raw)
In-Reply-To: <20220817131137.3978523-3-amadeuszx.slawinski@linux.intel.com>
On 8/17/2022 3:11 PM, Amadeusz Sławiński wrote:
> We can use existing macros to poll and update register values instead of
> open coding the functionality.
>
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> ---
> sound/hda/hdac_stream.c | 27 +++++++--------------------
> 1 file changed, 7 insertions(+), 20 deletions(-)
>
> diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
> index f3582012d22f..ce6a2f270445 100644
> --- a/sound/hda/hdac_stream.c
> +++ b/sound/hda/hdac_stream.c
> @@ -10,6 +10,7 @@
> #include <sound/core.h>
> #include <sound/pcm.h>
> #include <sound/hdaudio.h>
> +#include <sound/hdaudio_ext.h>
Eh... and this include addition should not be necessary after I moved
macros in previous patch. I will wait if there are any other comments
and send v2 tomorrow.
> #include <sound/hda_register.h>
> #include "trace.h"
>
> @@ -165,7 +166,6 @@ EXPORT_SYMBOL_GPL(snd_hdac_stop_streams_and_chip);
> void snd_hdac_stream_reset(struct hdac_stream *azx_dev)
> {
> unsigned char val;
> - int timeout;
> int dma_run_state;
>
> snd_hdac_stream_clear(azx_dev);
> @@ -173,30 +173,17 @@ void snd_hdac_stream_reset(struct hdac_stream *azx_dev)
> dma_run_state = snd_hdac_stream_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START;
>
> snd_hdac_stream_updateb(azx_dev, SD_CTL, 0, SD_CTL_STREAM_RESET);
> - udelay(3);
> - timeout = 300;
> - do {
> - val = snd_hdac_stream_readb(azx_dev, SD_CTL) &
> - SD_CTL_STREAM_RESET;
> - if (val)
> - break;
> - } while (--timeout);
> +
> + /* 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);
>
> if (azx_dev->bus->dma_stop_delay && dma_run_state)
> udelay(azx_dev->bus->dma_stop_delay);
>
> - val &= ~SD_CTL_STREAM_RESET;
> - snd_hdac_stream_writeb(azx_dev, SD_CTL, val);
> - udelay(3);
> + snd_hdac_stream_updateb(azx_dev, SD_CTL, SD_CTL_STREAM_RESET, 0);
>
> - timeout = 300;
> - /* waiting for hardware to report that the stream is out of reset */
> - do {
> - val = snd_hdac_stream_readb(azx_dev, SD_CTL) &
> - SD_CTL_STREAM_RESET;
> - if (!val)
> - break;
> - } while (--timeout);
> + /* 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);
>
> /* reset first position - may not be synced with hw at this time */
> if (azx_dev->posbuf)
next prev parent reply other threads:[~2022-08-17 13:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 13:11 [PATCH 0/4] ALSA: hda: Minor cleanups Amadeusz Sławiński
2022-08-17 13:11 ` [PATCH 1/4] ALSA: hda: Move stream-register polling macros Amadeusz Sławiński
2022-08-17 13:11 ` [PATCH 2/4] ALSA: hda: Rework snd_hdac_stream_reset() to use macros Amadeusz Sławiński
2022-08-17 13:20 ` Amadeusz Sławiński [this message]
2022-08-17 13:11 ` [PATCH 3/4] ALSA: hda: Remove unused MAX_PIN_CONFIGS constant Amadeusz Sławiński
2022-08-17 13:11 ` [PATCH 4/4] ALSA: hda: Remove unused defines Amadeusz Sławiński
2022-08-17 13:23 ` [PATCH 0/4] ALSA: hda: Minor cleanups Cezary Rojewski
2022-08-17 14:28 ` Cezary Rojewski
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=2888a74f-eb9c-cfef-1b1f-8bd81ab4bd1a@linux.intel.com \
--to=amadeuszx.slawinski@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=cezary.rojewski@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.com \
/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;
as well as URLs for NNTP newsgroup(s).