From: Takashi Iwai <tiwai@suse.de>
To: Mohan Kumar <mkumard@nvidia.com>
Cc: alsa-devel@alsa-project.org, spujar@nvidia.com, tiwai@suse.com,
jonathanh@nvidia.com, linux-tegra@vger.kernel.org,
treding@nvidia.com
Subject: Re: [PATCH 2/3] ALSA: hda: Add behaviour flag for dma stop delay
Date: Wed, 05 Aug 2020 11:29:41 +0200 [thread overview]
Message-ID: <s5hsgd1wid6.wl-tiwai@suse.de> (raw)
In-Reply-To: <20200805091116.2314-3-mkumard@nvidia.com>
On Wed, 05 Aug 2020 11:11:15 +0200,
Mohan Kumar wrote:
>
> Behaviour flag dma_stop_delay is added as a new member in hdac_bus
> structure to avoid memory decode error incase DMA RUN bit is not
> disabled in the given timeout from snd_hdac_stream_sync function and
> followed by stream reset which results in memory decode error between
> reset set and clear operation.
The new field looks like not only a flag but also contains the actual
delay time in usec. Please give a short comment at the struct field.
thanks,
Takashi
>
> Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
> ---
> include/sound/hdaudio.h | 2 ++
> sound/hda/hdac_stream.c | 7 +++++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
> index c1f78d9a6e47..cf77c6b83016 100644
> --- a/include/sound/hdaudio.h
> +++ b/include/sound/hdaudio.h
> @@ -347,6 +347,8 @@ struct hdac_bus {
>
> int bdl_pos_adj; /* BDL position adjustment */
>
> + unsigned int dma_stop_delay;
> +
> /* locks */
> spinlock_t reg_lock;
> struct mutex cmd_mutex;
> diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
> index a38a2af1654f..abe7a1b16fe1 100644
> --- a/sound/hda/hdac_stream.c
> +++ b/sound/hda/hdac_stream.c
> @@ -150,9 +150,12 @@ 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);
>
> + 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;
> @@ -162,6 +165,10 @@ void snd_hdac_stream_reset(struct hdac_stream *azx_dev)
> if (val)
> break;
> } while (--timeout);
> +
> + 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);
> --
> 2.17.1
>
WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Mohan Kumar <mkumard@nvidia.com>
Cc: <tiwai@suse.com>, <perex@perex.cz>, <alsa-devel@alsa-project.org>,
<linux-tegra@vger.kernel.org>, <treding@nvidia.com>,
<jonathanh@nvidia.com>, <spujar@nvidia.com>
Subject: Re: [PATCH 2/3] ALSA: hda: Add behaviour flag for dma stop delay
Date: Wed, 05 Aug 2020 11:29:41 +0200 [thread overview]
Message-ID: <s5hsgd1wid6.wl-tiwai@suse.de> (raw)
In-Reply-To: <20200805091116.2314-3-mkumard@nvidia.com>
On Wed, 05 Aug 2020 11:11:15 +0200,
Mohan Kumar wrote:
>
> Behaviour flag dma_stop_delay is added as a new member in hdac_bus
> structure to avoid memory decode error incase DMA RUN bit is not
> disabled in the given timeout from snd_hdac_stream_sync function and
> followed by stream reset which results in memory decode error between
> reset set and clear operation.
The new field looks like not only a flag but also contains the actual
delay time in usec. Please give a short comment at the struct field.
thanks,
Takashi
>
> Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
> ---
> include/sound/hdaudio.h | 2 ++
> sound/hda/hdac_stream.c | 7 +++++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
> index c1f78d9a6e47..cf77c6b83016 100644
> --- a/include/sound/hdaudio.h
> +++ b/include/sound/hdaudio.h
> @@ -347,6 +347,8 @@ struct hdac_bus {
>
> int bdl_pos_adj; /* BDL position adjustment */
>
> + unsigned int dma_stop_delay;
> +
> /* locks */
> spinlock_t reg_lock;
> struct mutex cmd_mutex;
> diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
> index a38a2af1654f..abe7a1b16fe1 100644
> --- a/sound/hda/hdac_stream.c
> +++ b/sound/hda/hdac_stream.c
> @@ -150,9 +150,12 @@ 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);
>
> + 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;
> @@ -162,6 +165,10 @@ void snd_hdac_stream_reset(struct hdac_stream *azx_dev)
> if (val)
> break;
> } while (--timeout);
> +
> + 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);
> --
> 2.17.1
>
next prev parent reply other threads:[~2020-08-05 9:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-05 9:11 [PATCH 0/3] Tegra Specific fixes Mohan Kumar
2020-08-05 9:11 ` Mohan Kumar
2020-08-05 9:11 ` [PATCH 1/3] ASoC: hda/tegra: Set buffer alignment to 128 bytes Mohan Kumar
2020-08-05 9:11 ` Mohan Kumar
2020-08-05 9:11 ` [PATCH 2/3] ALSA: hda: Add behaviour flag for dma stop delay Mohan Kumar
2020-08-05 9:11 ` Mohan Kumar
2020-08-05 9:29 ` Takashi Iwai [this message]
2020-08-05 9:29 ` Takashi Iwai
2020-08-05 9:11 ` [PATCH 3/3] ALSA: hda/tegra: Add 100us " Mohan Kumar
2020-08-05 9:11 ` Mohan Kumar
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=s5hsgd1wid6.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=jonathanh@nvidia.com \
--cc=linux-tegra@vger.kernel.org \
--cc=mkumard@nvidia.com \
--cc=spujar@nvidia.com \
--cc=tiwai@suse.com \
--cc=treding@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.