All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop
@ 2024-04-16 12:17 Pavel Hofman
  2024-04-16 12:17 ` [PATCH 1/3] ALSA:aloop: add DSD formats Pavel Hofman
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Pavel Hofman @ 2024-04-16 12:17 UTC (permalink / raw)
  To: alsa-devel; +Cc: Jaroslav Kysela, Takashi Iwai, Pavel Hofman

This patch series allows using the loopback driver in modern chains with
samplerates up to 768kHz and DSD formats.

The patch "ALSA:pcm: add support for 705.6kHz and 768kHz sample rates" is
basically a copy of commit 4cc4531c310e ("ALSA: pcm: add support for 352.8KHz and 384KHz sample rate").

As of loopback performance at 768kHz - in my tests aloop runs OK event at
12MHz samplerate.

Pavel Hofman (3):
  ALSA:aloop: add DSD formats
  ALSA:pcm: add support for 705.6kHz and 768kHz sample rates
  ALSA:aloop: add support for up to 768kHz sample rate

 include/sound/pcm.h     | 5 +++++
 sound/core/pcm_native.c | 2 +-
 sound/drivers/aloop.c   | 9 ++++++---
 3 files changed, 12 insertions(+), 4 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] ALSA:aloop: add DSD formats
  2024-04-16 12:17 [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop Pavel Hofman
@ 2024-04-16 12:17 ` Pavel Hofman
  2024-04-16 12:17 ` [PATCH 2/3] ALSA:pcm: add support for 705.6kHz and 768kHz sample rates Pavel Hofman
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Pavel Hofman @ 2024-04-16 12:17 UTC (permalink / raw)
  To: alsa-devel; +Cc: Jaroslav Kysela, Takashi Iwai, Pavel Hofman

The snd-aloop loopback driver does not modify or access the actual samples
in any way, defines no volume or mute controls, it's strictly bitperfect.
Therefore DSD formats can be supported without any modification.

Add all DSD formats to the list of supported formats.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
---
 sound/drivers/aloop.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 892c4e29c0a3..44ee2a4bc2b0 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -927,7 +927,10 @@ static const struct snd_pcm_hardware loopback_pcm_hardware =
 			 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE |
 			 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_3BE |
 			 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE |
-			 SNDRV_PCM_FMTBIT_FLOAT_LE | SNDRV_PCM_FMTBIT_FLOAT_BE),
+			 SNDRV_PCM_FMTBIT_FLOAT_LE | SNDRV_PCM_FMTBIT_FLOAT_BE |
+			 SNDRV_PCM_FMTBIT_DSD_U8 |
+			 SNDRV_PCM_FMTBIT_DSD_U16_LE | SNDRV_PCM_FMTBIT_DSD_U16_BE |
+			 SNDRV_PCM_FMTBIT_DSD_U32_LE | SNDRV_PCM_FMTBIT_DSD_U32_BE),
 	.rates =	SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_192000,
 	.rate_min =		8000,
 	.rate_max =		192000,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] ALSA:pcm: add support for 705.6kHz and 768kHz sample rates
  2024-04-16 12:17 [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop Pavel Hofman
  2024-04-16 12:17 ` [PATCH 1/3] ALSA:aloop: add DSD formats Pavel Hofman
@ 2024-04-16 12:17 ` Pavel Hofman
  2024-04-16 12:17 ` [PATCH 3/3] ALSA:aloop: add support for up to 768kHz sample rate Pavel Hofman
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Pavel Hofman @ 2024-04-16 12:17 UTC (permalink / raw)
  To: alsa-devel; +Cc: Jaroslav Kysela, Takashi Iwai, Pavel Hofman

Many modern codecs support 705.6kHz and 768kHz sample rates. Current HW
params fail to set 705.6kHz and 768kHz sample rates as these are not in the
known-rates list.

Add these new rates to the known-rates list to allow them.

Also add defines in pcm.h so that drivers can use it.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
---
 include/sound/pcm.h     | 5 +++++
 sound/core/pcm_native.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 210096f124ee..61c6054618c8 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -120,6 +120,8 @@ struct snd_pcm_ops {
 #define SNDRV_PCM_RATE_192000		(1U<<12)	/* 192000Hz */
 #define SNDRV_PCM_RATE_352800		(1U<<13)	/* 352800Hz */
 #define SNDRV_PCM_RATE_384000		(1U<<14)	/* 384000Hz */
+#define SNDRV_PCM_RATE_705600		(1U<<15)	/* 705600Hz */
+#define SNDRV_PCM_RATE_768000		(1U<<16)	/* 768000Hz */
 
 #define SNDRV_PCM_RATE_CONTINUOUS	(1U<<30)	/* continuous range */
 #define SNDRV_PCM_RATE_KNOT		(1U<<31)	/* supports more non-continuos rates */
@@ -135,6 +137,9 @@ struct snd_pcm_ops {
 #define SNDRV_PCM_RATE_8000_384000	(SNDRV_PCM_RATE_8000_192000|\
 					 SNDRV_PCM_RATE_352800|\
 					 SNDRV_PCM_RATE_384000)
+#define SNDRV_PCM_RATE_8000_768000	(SNDRV_PCM_RATE_8000_384000|\
+					 SNDRV_PCM_RATE_705600|\
+					 SNDRV_PCM_RATE_768000)
 #define _SNDRV_PCM_FMTBIT(fmt)		(1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt)
 #define SNDRV_PCM_FMTBIT_S8		_SNDRV_PCM_FMTBIT(S8)
 #define SNDRV_PCM_FMTBIT_U8		_SNDRV_PCM_FMTBIT(U8)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 0b76e76823d2..521ba56392a0 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2416,7 +2416,7 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params,
 
 static const unsigned int rates[] = {
 	5512, 8000, 11025, 16000, 22050, 32000, 44100,
-	48000, 64000, 88200, 96000, 176400, 192000, 352800, 384000
+	48000, 64000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000
 };
 
 const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] ALSA:aloop: add support for up to 768kHz sample rate
  2024-04-16 12:17 [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop Pavel Hofman
  2024-04-16 12:17 ` [PATCH 1/3] ALSA:aloop: add DSD formats Pavel Hofman
  2024-04-16 12:17 ` [PATCH 2/3] ALSA:pcm: add support for 705.6kHz and 768kHz sample rates Pavel Hofman
@ 2024-04-16 12:17 ` Pavel Hofman
  2024-04-16 13:49 ` [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop Jaroslav Kysela
  2024-04-18  7:31 ` Takashi Iwai
  4 siblings, 0 replies; 6+ messages in thread
From: Pavel Hofman @ 2024-04-16 12:17 UTC (permalink / raw)
  To: alsa-devel; +Cc: Jaroslav Kysela, Takashi Iwai, Pavel Hofman

Many modern codecs support rates up to 768kHz (including DSD1024). Add
support for rates up to 768kHz to the loopback driver.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
---
 sound/drivers/aloop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 44ee2a4bc2b0..d6dd4b8c750a 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -931,9 +931,9 @@ static const struct snd_pcm_hardware loopback_pcm_hardware =
 			 SNDRV_PCM_FMTBIT_DSD_U8 |
 			 SNDRV_PCM_FMTBIT_DSD_U16_LE | SNDRV_PCM_FMTBIT_DSD_U16_BE |
 			 SNDRV_PCM_FMTBIT_DSD_U32_LE | SNDRV_PCM_FMTBIT_DSD_U32_BE),
-	.rates =	SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_192000,
+	.rates =	SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_768000,
 	.rate_min =		8000,
-	.rate_max =		192000,
+	.rate_max =		768000,
 	.channels_min =		1,
 	.channels_max =		32,
 	.buffer_bytes_max =	2 * 1024 * 1024,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop
  2024-04-16 12:17 [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop Pavel Hofman
                   ` (2 preceding siblings ...)
  2024-04-16 12:17 ` [PATCH 3/3] ALSA:aloop: add support for up to 768kHz sample rate Pavel Hofman
@ 2024-04-16 13:49 ` Jaroslav Kysela
  2024-04-18  7:31 ` Takashi Iwai
  4 siblings, 0 replies; 6+ messages in thread
From: Jaroslav Kysela @ 2024-04-16 13:49 UTC (permalink / raw)
  To: Pavel Hofman, alsa-devel; +Cc: Takashi Iwai, linux-sound

On 16. 04. 24 14:17, Pavel Hofman wrote:
> This patch series allows using the loopback driver in modern chains with
> samplerates up to 768kHz and DSD formats.
> 
> The patch "ALSA:pcm: add support for 705.6kHz and 768kHz sample rates" is
> basically a copy of commit 4cc4531c310e ("ALSA: pcm: add support for 352.8KHz and 384KHz sample rate").
> 
> As of loopback performance at 768kHz - in my tests aloop runs OK event at
> 12MHz samplerate.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>

Note that the kernel patches should go through <linux-sound@vger.kernel.org> 
mailing list (see MAINTAINERS) now.

Link: 
https://lore.kernel.org/alsa-devel/20240416121726.628679-1-pavel.hofman@ivitera.com/

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop
  2024-04-16 12:17 [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop Pavel Hofman
                   ` (3 preceding siblings ...)
  2024-04-16 13:49 ` [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop Jaroslav Kysela
@ 2024-04-18  7:31 ` Takashi Iwai
  4 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2024-04-18  7:31 UTC (permalink / raw)
  To: Pavel Hofman; +Cc: alsa-devel, Jaroslav Kysela

On Tue, 16 Apr 2024 14:17:23 +0200,
Pavel Hofman wrote:
> 
> This patch series allows using the loopback driver in modern chains with
> samplerates up to 768kHz and DSD formats.
> 
> The patch "ALSA:pcm: add support for 705.6kHz and 768kHz sample rates" is
> basically a copy of commit 4cc4531c310e ("ALSA: pcm: add support for 352.8KHz and 384KHz sample rate").
> 
> As of loopback performance at 768kHz - in my tests aloop runs OK event at
> 12MHz samplerate.
> 
> Pavel Hofman (3):
>   ALSA:aloop: add DSD formats
>   ALSA:pcm: add support for 705.6kHz and 768kHz sample rates
>   ALSA:aloop: add support for up to 768kHz sample rate

Applied to for-next branch now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-18  7:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-16 12:17 [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop Pavel Hofman
2024-04-16 12:17 ` [PATCH 1/3] ALSA:aloop: add DSD formats Pavel Hofman
2024-04-16 12:17 ` [PATCH 2/3] ALSA:pcm: add support for 705.6kHz and 768kHz sample rates Pavel Hofman
2024-04-16 12:17 ` [PATCH 3/3] ALSA:aloop: add support for up to 768kHz sample rate Pavel Hofman
2024-04-16 13:49 ` [PATCH 0/3] adding 705.6/768kHz rates; DSD and 768kHz in aloop Jaroslav Kysela
2024-04-18  7:31 ` Takashi Iwai

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.