All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: pcm: add 24KHz sample rate definition
@ 2022-06-10 19:09 Patrick Lai
  2022-06-11  7:00 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Lai @ 2022-06-10 19:09 UTC (permalink / raw)
  To: tiwai; +Cc: Patrick Lai, alsa-devel

Add 24KHz sample rate definition as some hardware
can support 24KHz sample rate PCM data

Signed-off-by: Patrick Lai <quic_plai@quicinc.com>
---
 include/sound/pcm.h     | 24 +++++++++++++-----------
 sound/core/pcm_native.c |  4 ++--
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 6b99310b5b88..a761a4459091 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -111,23 +111,25 @@ struct snd_pcm_ops {
 #define SNDRV_PCM_RATE_11025		(1<<2)		/* 11025Hz */
 #define SNDRV_PCM_RATE_16000		(1<<3)		/* 16000Hz */
 #define SNDRV_PCM_RATE_22050		(1<<4)		/* 22050Hz */
-#define SNDRV_PCM_RATE_32000		(1<<5)		/* 32000Hz */
-#define SNDRV_PCM_RATE_44100		(1<<6)		/* 44100Hz */
-#define SNDRV_PCM_RATE_48000		(1<<7)		/* 48000Hz */
-#define SNDRV_PCM_RATE_64000		(1<<8)		/* 64000Hz */
-#define SNDRV_PCM_RATE_88200		(1<<9)		/* 88200Hz */
-#define SNDRV_PCM_RATE_96000		(1<<10)		/* 96000Hz */
-#define SNDRV_PCM_RATE_176400		(1<<11)		/* 176400Hz */
-#define SNDRV_PCM_RATE_192000		(1<<12)		/* 192000Hz */
-#define SNDRV_PCM_RATE_352800		(1<<13)		/* 352800Hz */
-#define SNDRV_PCM_RATE_384000		(1<<14)		/* 384000Hz */
+#define SNDDV_PCM_RATE_24000		(1<<5)		/* 24000Hz */
+#define SNDRV_PCM_RATE_32000		(1<<6)		/* 32000Hz */
+#define SNDRV_PCM_RATE_44100		(1<<7)		/* 44100Hz */
+#define SNDRV_PCM_RATE_48000		(1<<8)		/* 48000Hz */
+#define SNDRV_PCM_RATE_64000		(1<<9)		/* 64000Hz */
+#define SNDRV_PCM_RATE_88200		(1<<10)		/* 88200Hz */
+#define SNDRV_PCM_RATE_96000		(1<<11)		/* 96000Hz */
+#define SNDRV_PCM_RATE_176400		(1<<12)		/* 176400Hz */
+#define SNDRV_PCM_RATE_192000		(1<<13)		/* 192000Hz */
+#define SNDRV_PCM_RATE_352800		(1<<14)		/* 352800Hz */
+#define SNDRV_PCM_RATE_384000		(1<<15)		/* 384000Hz */
 
 #define SNDRV_PCM_RATE_CONTINUOUS	(1<<30)		/* continuous range */
 #define SNDRV_PCM_RATE_KNOT		(1<<31)		/* supports more non-continuos rates */
 
 #define SNDRV_PCM_RATE_8000_44100	(SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_11025|\
 					 SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_22050|\
-					 SNDRV_PCM_RATE_32000|SNDRV_PCM_RATE_44100)
+					 SNDRV_PCM_RATE_24000|SNDRV_PCM_RATE_32000|\
+					 SNDRV_PCM_RATE_44100)
 #define SNDRV_PCM_RATE_8000_48000	(SNDRV_PCM_RATE_8000_44100|SNDRV_PCM_RATE_48000)
 #define SNDRV_PCM_RATE_8000_96000	(SNDRV_PCM_RATE_8000_48000|SNDRV_PCM_RATE_64000|\
 					 SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 4adaee62ef33..72e3eab09518 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2442,12 +2442,12 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params,
 	return snd_interval_refine(hw_param_interval(params, rule->var), &t);
 }
 
-#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_192000 != 1 << 12
+#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_192000 != 1 << 13
 #error "Change this table"
 #endif
 
 static const unsigned int rates[] = {
-	5512, 8000, 11025, 16000, 22050, 32000, 44100,
+	5512, 8000, 11025, 16000, 22050, 24000, 32000, 44100,
 	48000, 64000, 88200, 96000, 176400, 192000, 352800, 384000
 };
 
-- 
2.36.1


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

* Re: [PATCH] ALSA: pcm: add 24KHz sample rate definition
  2022-06-10 19:09 [PATCH] ALSA: pcm: add 24KHz sample rate definition Patrick Lai
@ 2022-06-11  7:00 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2022-06-11  7:00 UTC (permalink / raw)
  To: Patrick Lai; +Cc: alsa-devel, tiwai

On Fri, 10 Jun 2022 21:09:31 +0200,
Patrick Lai wrote:
> 
> Add 24KHz sample rate definition as some hardware
> can support 24KHz sample rate PCM data
> 
> Signed-off-by: Patrick Lai <quic_plai@quicinc.com>

You don't have to add a rate to the standard rate table at all.
Quite a few drivers do support 24kHz just with the normal hw
constraints.


thanks,

Takashi

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

end of thread, other threads:[~2022-06-11  7:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 19:09 [PATCH] ALSA: pcm: add 24KHz sample rate definition Patrick Lai
2022-06-11  7:00 ` 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.