[PATCH 1/3] ALSA: pcm: add support for 128kHz sample rate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The usual sample rate possible on an SPDIF link are
32k, 44.1k, 48k, 88.2k, 96k, 172.4k and 192k.

With higher bandwidth variant, such as eARC, and the introduction of 8
channels mode, the spdif frame rate may be multiplied by 4. This happens
when the interface use an IEC958_SUBFRAME format.

The spdif 8 channel mode rate list is:
128k, 176.4k, 192k, 352.8k, 384k, 705.4k and 768k.

All are already supported by ASLA expect for the 128kHz one.
Add support for it but do not insert it the SNDRV_PCM_RATE_8000_192000
macro. Doing so would silently add 128k support to a lot of HW which
probably do not support it.

Signed-off-by: Jerome Brunet <jbrunet@xxxxxxxxxxxx>
---
 include/sound/pcm.h     | 13 +++++++------
 sound/core/pcm_native.c |  6 +++---
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 3edd7a7346da..9cda92b34eda 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -116,12 +116,13 @@ struct snd_pcm_ops {
 #define SNDRV_PCM_RATE_64000		(1U<<8)		/* 64000Hz */
 #define SNDRV_PCM_RATE_88200		(1U<<9)		/* 88200Hz */
 #define SNDRV_PCM_RATE_96000		(1U<<10)	/* 96000Hz */
-#define SNDRV_PCM_RATE_176400		(1U<<11)	/* 176400Hz */
-#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_128000		(1U<<11)	/* 128000Hz */
+#define SNDRV_PCM_RATE_176400		(1U<<12)	/* 176400Hz */
+#define SNDRV_PCM_RATE_192000		(1U<<13)	/* 192000Hz */
+#define SNDRV_PCM_RATE_352800		(1U<<14)	/* 352800Hz */
+#define SNDRV_PCM_RATE_384000		(1U<<15)	/* 384000Hz */
+#define SNDRV_PCM_RATE_705600		(1U<<16)	/* 705600Hz */
+#define SNDRV_PCM_RATE_768000		(1U<<17)	/* 768000Hz */
 
 #define SNDRV_PCM_RATE_CONTINUOUS	(1U<<30)	/* continuous range */
 #define SNDRV_PCM_RATE_KNOT		(1U<<31)	/* supports more non-continuous rates */
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 521ba56392a0..87eeb9b7f54a 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2410,13 +2410,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_768000 != 1 << 17
 #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, 705600, 768000
+	5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200,
+	96000, 128000, 176400, 192000, 352800, 384000, 705600, 768000,
 };
 
 const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = {
-- 
2.43.0




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux