All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org
Cc: lgirdwood@gmail.com, Cezary Rojewski <cezary.rojewski@intel.com>,
	broonie@kernel.org, tiwai@suse.com,
	pierre-louis.bossart@linux.intel.com
Subject: [alsa-devel] [PATCH v2 04/11] ALSA: core: Expand DMA buffer information
Date: Mon, 27 Jan 2020 13:12:36 +0100	[thread overview]
Message-ID: <20200127121243.15813-5-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20200127121243.15813-1-cezary.rojewski@intel.com>

Update DMA buffer definition for snd_compr_runtime so it is represented
similarly as in snd_pcm_runtime. While at it, modify
snd_compr_set_runtime_buffer to account for newly added members.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 include/sound/compress_driver.h | 35 ++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index bc88d6f964da..00f633c0c3ba 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -23,7 +23,6 @@ struct snd_compr_ops;
  * struct snd_compr_runtime: runtime stream description
  * @state: stream state
  * @ops: pointer to DSP callbacks
- * @dma_buffer_p: runtime dma buffer pointer
  * @buffer: pointer to kernel buffer, valid only when not in mmap mode or
  *	DSP doesn't implement copy
  * @buffer_size: size of the above buffer
@@ -34,11 +33,14 @@ struct snd_compr_ops;
  * @total_bytes_transferred: cumulative bytes transferred by offload DSP
  * @sleep: poll sleep
  * @private_data: driver private data pointer
+ * @dma_area: virtual buffer address
+ * @dma_addr: physical buffer address (not accessible from main CPU)
+ * @dma_bytes: size of DMA area
+ * @dma_buffer_p: runtime dma buffer pointer
  */
 struct snd_compr_runtime {
 	snd_pcm_state_t state;
 	struct snd_compr_ops *ops;
-	struct snd_dma_buffer *dma_buffer_p;
 	void *buffer;
 	u64 buffer_size;
 	u32 fragment_size;
@@ -47,6 +49,11 @@ struct snd_compr_runtime {
 	u64 total_bytes_transferred;
 	wait_queue_head_t sleep;
 	void *private_data;
+
+	unsigned char *dma_area;
+	dma_addr_t dma_addr;
+	size_t dma_bytes;
+	struct snd_dma_buffer *dma_buffer_p;
 };
 
 /**
@@ -180,19 +187,29 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
 
 /**
  * snd_compr_set_runtime_buffer - Set the Compress runtime buffer
- * @substream: compress substream to set
+ * @stream: compress stream to set
  * @bufp: the buffer information, NULL to clear
  *
  * Copy the buffer information to runtime buffer when @bufp is non-NULL.
  * Otherwise it clears the current buffer information.
  */
-static inline void snd_compr_set_runtime_buffer(
-					struct snd_compr_stream *substream,
-					struct snd_dma_buffer *bufp)
+static inline void
+snd_compr_set_runtime_buffer(struct snd_compr_stream *stream,
+			     struct snd_dma_buffer *bufp)
 {
-	struct snd_compr_runtime *runtime = substream->runtime;
-
-	runtime->dma_buffer_p = bufp;
+	struct snd_compr_runtime *runtime = stream->runtime;
+
+	if (bufp) {
+		runtime->dma_buffer_p = bufp;
+		runtime->dma_area = bufp->area;
+		runtime->dma_addr = bufp->addr;
+		runtime->dma_bytes = bufp->bytes;
+	} else {
+		runtime->dma_buffer_p = NULL;
+		runtime->dma_area = NULL;
+		runtime->dma_addr = 0;
+		runtime->dma_bytes = 0;
+	}
 }
 
 int snd_compr_stop_error(struct snd_compr_stream *stream,
-- 
2.17.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2020-01-27 12:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-27 12:12 [alsa-devel] [PATCH v2 00/11] ASoC: SOF: Data probing Cezary Rojewski
2020-01-27 12:12 ` [alsa-devel] [PATCH v2 01/11] ALSA: hda: Allow for compress stream to hdac_ext_stream assignment Cezary Rojewski
2020-01-27 12:12 ` [alsa-devel] [PATCH v2 02/11] ALSA: hda: Prepare for compress stream support Cezary Rojewski
2020-01-27 12:12 ` [alsa-devel] [PATCH v2 03/11] ALSA: hda: Interrupt servicing and BDL setup for compress streams Cezary Rojewski
2020-01-27 12:12 ` Cezary Rojewski [this message]
2020-01-27 12:12 ` [alsa-devel] [PATCH v2 05/11] ALSA: core: Implement compress page allocation and free routines Cezary Rojewski
2020-01-27 12:12 ` [alsa-devel] [PATCH v2 06/11] ASoC: SOF: Intel: Account for compress streams when servicing IRQs Cezary Rojewski
2020-01-27 12:12 ` [alsa-devel] [PATCH v2 07/11] ASoC: SOF: Implement Probe IPC API Cezary Rojewski
2020-01-27 20:57   ` Pierre-Louis Bossart
2020-01-28 10:47     ` Cezary Rojewski
2020-01-27 21:01   ` Pierre-Louis Bossart
2020-01-28 10:49     ` Cezary Rojewski
2020-01-27 21:09   ` Pierre-Louis Bossart
2020-01-28 10:50     ` Cezary Rojewski
2020-01-27 21:20   ` Pierre-Louis Bossart
2020-01-28 10:54     ` Cezary Rojewski
2020-01-27 12:12 ` [alsa-devel] [PATCH v2 08/11] ASoC: SOF: Generic probe compress operations Cezary Rojewski
2020-01-27 21:17   ` Pierre-Louis Bossart
2020-01-28 10:57     ` Cezary Rojewski
2020-01-27 12:12 ` [alsa-devel] [PATCH v2 09/11] ASoC: SOF: Intel: Probe " Cezary Rojewski
2020-01-27 12:12 ` [alsa-devel] [PATCH v2 10/11] ASoC: SOF: Provide probe debugfs support Cezary Rojewski
2020-01-27 12:12 ` [alsa-devel] [PATCH v2 11/11] ASoC: SOF: Intel: Add Probe compress CPU DAIs 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=20200127121243.15813-5-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --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 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.