From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org
Cc: pierre-louis.bossart@linux.intel.com,
Cezary Rojewski <cezary.rojewski@intel.com>,
Divya Prakash <divya1.prakash@intel.com>,
lgirdwood@gmail.com, tiwai@suse.com, broonie@kernel.org
Subject: [alsa-devel] [PATCH 3/7] ALSA: hda: Interrupt servicing and BDL setup for compress streams
Date: Tue, 17 Dec 2019 10:58:47 +0100 [thread overview]
Message-ID: <20191217095851.19629-4-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20191217095851.19629-1-cezary.rojewski@intel.com>
Account for compress streams when receiving and servicing buffer
completed interrupts. In case of compress stream enlisting hdac_stream
for data transfer, setup BDL entries much like it is the case for PCM
streams.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Divya Prakash <divya1.prakash@intel.com>
---
sound/hda/hdac_controller.c | 4 ++--
sound/hda/hdac_stream.c | 26 ++++++++++++++++++++------
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
index 7e7be8e4dcf9..585908f58028 100644
--- a/sound/hda/hdac_controller.c
+++ b/sound/hda/hdac_controller.c
@@ -553,8 +553,8 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
sd_status = snd_hdac_stream_readb(azx_dev, SD_STS);
snd_hdac_stream_writeb(azx_dev, SD_STS, SD_INT_MASK);
handled |= 1 << azx_dev->index;
- if (!azx_dev->substream || !azx_dev->running ||
- !(sd_status & SD_INT_COMPLETE))
+ if ((!azx_dev->substream && !azx_dev->cstream) ||
+ !azx_dev->running || !(sd_status & SD_INT_COMPLETE))
continue;
if (ack)
ack(bus, azx_dev);
diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
index d00c81e34cde..bf6795d73bcd 100644
--- a/sound/hda/hdac_stream.c
+++ b/sound/hda/hdac_stream.c
@@ -7,6 +7,7 @@
#include <linux/delay.h>
#include <linux/export.h>
#include <linux/clocksource.h>
+#include <sound/compress_driver.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/hdaudio.h>
@@ -410,14 +411,20 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
{
struct hdac_bus *bus = azx_dev->bus;
struct snd_pcm_substream *substream = azx_dev->substream;
+ struct snd_compr_stream *cstream = azx_dev->cstream;
struct snd_pcm_runtime *runtime;
struct snd_dma_buffer *dmab;
__le32 *bdl;
int i, ofs, periods, period_bytes;
int pos_adj, pos_align;
- runtime = substream->runtime;
- dmab = snd_pcm_get_dma_buf(substream);
+ if (substream) {
+ runtime = substream->runtime;
+ dmab = snd_pcm_get_dma_buf(substream);
+ } else {
+ runtime = NULL;
+ dmab = snd_pcm_get_dma_buf(cstream);
+ }
/* reset BDL address */
snd_hdac_stream_writel(azx_dev, SD_BDLPL, 0);
@@ -486,15 +493,22 @@ int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
unsigned int format_val)
{
struct snd_pcm_substream *substream = azx_dev->substream;
+ struct snd_compr_stream *cstream = azx_dev->cstream;
unsigned int bufsize, period_bytes;
unsigned int no_period_wakeup;
int err;
- if (!substream)
+ if (substream) {
+ bufsize = snd_pcm_lib_buffer_bytes(substream);
+ period_bytes = snd_pcm_lib_period_bytes(substream);
+ no_period_wakeup = substream->runtime->no_period_wakeup;
+ } else if (cstream) {
+ bufsize = cstream->runtime->buffer_size;
+ period_bytes = cstream->runtime->fragment_size;
+ no_period_wakeup = 0;
+ } else {
return -EINVAL;
- bufsize = snd_pcm_lib_buffer_bytes(substream);
- period_bytes = snd_pcm_lib_period_bytes(substream);
- no_period_wakeup = substream->runtime->no_period_wakeup;
+ }
if (bufsize != azx_dev->bufsize ||
period_bytes != azx_dev->period_bytes ||
--
2.17.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2019-12-17 10:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 9:58 [alsa-devel] [PATCH 0/7] ALSA: hda: Enable HDAudio compress Cezary Rojewski
2019-12-17 9:58 ` [alsa-devel] [PATCH 1/7] ALSA: hda: Allow for compress stream to hdac_ext_stream assignment Cezary Rojewski
2019-12-17 10:19 ` Takashi Iwai
2019-12-17 12:06 ` Cezary Rojewski
2020-01-07 16:13 ` Cezary Rojewski
2019-12-17 9:58 ` [alsa-devel] [PATCH 2/7] ALSA: hda: Prepare for compress stream support Cezary Rojewski
2019-12-17 9:58 ` Cezary Rojewski [this message]
2019-12-17 9:58 ` [alsa-devel] [PATCH 4/7] ALSA: core: Expand DMA buffer information Cezary Rojewski
2019-12-17 10:23 ` Takashi Iwai
2019-12-17 12:13 ` Cezary Rojewski
2019-12-17 9:58 ` [alsa-devel] [PATCH 5/7] ALSA: core: Implement compress page allocation and free routines Cezary Rojewski
2019-12-17 10:24 ` Takashi Iwai
2019-12-17 12:22 ` Cezary Rojewski
2019-12-17 14:06 ` Pierre-Louis Bossart
2019-12-17 9:58 ` [alsa-devel] [PATCH 6/7] ASoC: compress: Add pm_runtime support Cezary Rojewski
2019-12-17 12:39 ` [alsa-devel] Applied "ASoC: compress: Add pm_runtime support" to the asoc tree Mark Brown
2019-12-17 9:58 ` [alsa-devel] [PATCH 7/7] ASoC: SOF: Intel: Account for compress streams when servicing IRQs Cezary Rojewski
2019-12-17 10:30 ` Takashi Iwai
2019-12-17 12:33 ` 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=20191217095851.19629-4-cezary.rojewski@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=divya1.prakash@intel.com \
--cc=lgirdwood@gmail.com \
--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