From: Jerome Brunet <jbrunet@baylibre.com>
To: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>
Cc: Jerome Brunet <jbrunet@baylibre.com>,
alsa-devel@alsa-project.org, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] ALSA: pcm: add support for 128kHz sample rate
Date: Fri, 28 Jun 2024 14:23:06 +0200 [thread overview]
Message-ID: <20240628122429.2018059-2-jbrunet@baylibre.com> (raw)
In-Reply-To: <20240628122429.2018059-1-jbrunet@baylibre.com>
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@baylibre.com>
---
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
next prev parent reply other threads:[~2024-06-28 12:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 12:23 [PATCH 0/3] ALSA: update sample rate definition for eARC Jerome Brunet
2024-06-28 12:23 ` Jerome Brunet [this message]
2024-06-29 23:29 ` [PATCH 1/3] ALSA: pcm: add support for 128kHz sample rate kernel test robot
2024-06-30 6:53 ` Jerome Brunet
2024-07-01 14:04 ` Takashi Iwai
2024-06-30 1:10 ` kernel test robot
2024-07-01 8:50 ` Amadeusz Sławiński
2024-07-01 14:07 ` Takashi Iwai
2024-07-08 13:34 ` Jerome Brunet
2024-07-08 14:00 ` Takashi Iwai
2024-08-09 8:29 ` Jerome Brunet
2024-08-09 8:42 ` Takashi Iwai
2024-08-09 23:27 ` Mark Brown
2024-06-28 12:23 ` [PATCH 2/3] ALSA: IEC958 definition for consumer status channel update Jerome Brunet
2024-06-28 12:23 ` [PATCH 3/3] ASoC: spdif: extend supported rates to 768kHz Jerome Brunet
2024-06-28 12:34 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240628122429.2018059-2-jbrunet@baylibre.com \
--to=jbrunet@baylibre.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox