diff mbox series

ALSA: pcm: add 24KHz sample rate definition

Message ID 20220610190931.24760-1-quic_plai@quicinc.com (mailing list archive)
State New, archived
Headers show
Series ALSA: pcm: add 24KHz sample rate definition | expand

Commit Message

Patrick Lai June 10, 2022, 7:09 p.m. UTC
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(-)

Comments

Takashi Iwai June 11, 2022, 7 a.m. UTC | #1
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
diff mbox series

Patch

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
 };