All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: "Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	tiwai@suse.de,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
	"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
	broonie@kernel.org,
	"Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
Subject: [PATCH v2 1/3] ALSA: pcm: introduce INFO_NO_REWINDS flag
Date: Mon,  4 Oct 2021 11:24:21 -0500	[thread overview]
Message-ID: <20211004162423.85323-2-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20211004162423.85323-1-pierre-louis.bossart@linux.intel.com>

When the hardware can only deal with a monotonically increasing
appl_ptr, this flag can be set. In case the application requests a
rewind, snd_pcm_rewind() will not return an error code but signal that
the appl_ptr was not modified.

Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 include/uapi/sound/asound.h | 2 +-
 sound/core/pcm_native.c     | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 1d84ec9db93b..bdb6f3c9db6c 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -300,7 +300,7 @@ typedef int __bitwise snd_pcm_subformat_t;
 #define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME    0x04000000  /* report estimated link audio time */
 #define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000  /* report synchronized audio/system time */
 #define SNDRV_PCM_INFO_EXPLICIT_SYNC	0x10000000	/* needs explicit sync of pointers and data */
-
+#define SNDRV_PCM_INFO_NO_REWINDS	0x20000000	/* hardware can only support monotonic changes of appl_ptr */
 #define SNDRV_PCM_INFO_DRAIN_TRIGGER	0x40000000		/* internal kernel flag - trigger in drain */
 #define SNDRV_PCM_INFO_FIFO_IN_FRAMES	0x80000000	/* internal kernel flag - FIFO size is in frames */
 
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index d233cb3b41d8..e3da2cc31a34 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2905,6 +2905,8 @@ static snd_pcm_sframes_t snd_pcm_rewind(struct snd_pcm_substream *substream,
 
 	if (frames == 0)
 		return 0;
+	if (substream->runtime->info & SNDRV_PCM_INFO_NO_REWINDS)
+		return 0;
 
 	snd_pcm_stream_lock_irq(substream);
 	ret = do_pcm_hwsync(substream);
-- 
2.25.1


  reply	other threads:[~2021-10-04 17:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 16:24 [PATCH v2 0/3] ASoC: SOF: Intel: power optimizations with HDaudio SPIB register Pierre-Louis Bossart
2021-10-04 16:24 ` Pierre-Louis Bossart [this message]
2021-10-05  6:59   ` [PATCH v2 1/3] ALSA: pcm: introduce INFO_NO_REWINDS flag Takashi Iwai
2021-10-05 13:10     ` Pierre-Louis Bossart
2021-10-05 13:35       ` Takashi Iwai
2021-10-12  0:19         ` Pierre-Louis Bossart
2021-10-12  6:11           ` Takashi Iwai
2021-10-12 15:15             ` Pierre-Louis Bossart
2021-10-12 15:27               ` Takashi Iwai
2021-10-12 16:41                 ` Pierre-Louis Bossart
2021-10-12 17:16                   ` Takashi Iwai
2021-10-12 18:02                     ` Pierre-Louis Bossart
2021-10-12 20:04                       ` Takashi Iwai
2021-10-04 16:24 ` [PATCH v2 2/3] ASOC: SOF: pcm: add .ack callback support Pierre-Louis Bossart
2021-10-04 16:24 ` [PATCH v2 3/3] ASoC: SOF: Intel: add .ack support for HDaudio platforms Pierre-Louis Bossart

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=20211004162423.85323-2-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.de \
    /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.