[alsa-devel] [RFC PATCH 2/3] ALSA:core: Add rate 24kHz
Pawel Harlozinski
pawel.harlozinski at linux.intel.com
Thu Sep 5 07:33:00 CEST 2019
Adds SNDRV_PCM_RATE_24000 at the bottom to keep backward compability
with alsa library.
Signed-off-by: Pawel Harlozinski <pawel.harlozinski at linux.intel.com>
---
include/sound/pcm.h | 1 +
sound/core/pcm_native.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index bbe6eb1ff5d2..09d0a2a2dce8 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -119,6 +119,7 @@ struct snd_pcm_ops {
#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 SNDRV_PCM_RATE_24000 (1<<15) /* 24000Hz */
#define SNDRV_PCM_RATE_CONTINUOUS (1<<30) /* continuous range */
#define SNDRV_PCM_RATE_KNOT (1<<31) /* supports more non-continuos rates */
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 11e653c8aa0e..f52f28e3edb1 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2164,13 +2164,13 @@ 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 << 12 || SNDRV_PCM_RATE_24000 != 1 << 15
#error "Change this table"
#endif
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, 24000
};
const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = {
--
2.17.1
More information about the Alsa-devel
mailing list