From: Daniel Mack <zonque@gmail.com>
To: alsa-devel@alsa-project.org
Cc: jussi@sonarnerd.net, tiwai@suse.de, clemens@ladisch.de,
Daniel Mack <zonque@gmail.com>,
demian@auraliti.com, ray@auraliti.com, andreas@akdesigninc.com
Subject: [PATCH 1/2] ALSA: add DSD formats
Date: Sat, 6 Apr 2013 13:44:51 +0200 [thread overview]
Message-ID: <1365248693-27867-1-git-send-email-zonque@gmail.com> (raw)
This patch adds two formats for Direct Stream Digital (DSD), a
pulse-density encoding format which is described here:
https://en.wikipedia.org/wiki/Direct_Stream_Digital
DSD operates on 2.8, 5.6 or 11.2MHz sample rates and as a 1-bit
stream. In order to provide a compatibility way for pushing DSD
samples through ordinary PCM channels, the "DoP open Standard" was
invented. See http://www.dsd-guide.com for a copy of the documentation.
The two new types added by this patch describe streams that are capable
of handling DSD samples in DOP format as 8-bit or in 16-bit (or at a x8
or x16 data rate, respectively).
DSD itself specifies samples in *bit*, while DOP and ALSA handle them
as *bytes*. Hence, a factor of 8 or 16 has to be applied for the sample
rare configuration, according to the following table:
configured hardware
352.8kHz 705.6KHz 1411.2KHz <---- sample rate
8-bit 2.8MHz 5.6MHz 11.2MHz
16-bit 5.6MHz 11.2MHz
`-----------------------------------'
actual DSD sample rates
Signed-off-by: Daniel Mack <zonque@gmail.com>
---
include/sound/pcm.h | 2 ++
include/uapi/sound/asound.h | 4 +++-
sound/core/pcm.c | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index aa7b0a8..d957046 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -181,6 +181,8 @@ struct snd_pcm_ops {
#define SNDRV_PCM_FMTBIT_G723_24_1B _SNDRV_PCM_FMTBIT(G723_24_1B)
#define SNDRV_PCM_FMTBIT_G723_40 _SNDRV_PCM_FMTBIT(G723_40)
#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B)
+#define SNDRV_PCM_FMTBIT_DSD_DOP_U8 _SNDRV_PCM_FMTBIT(DSD_DOP_U8)
+#define SNDRV_PCM_FMTBIT_DSD_DOP_U16 _SNDRV_PCM_FMTBIT(DSD_DOP_U16)
#ifdef SNDRV_LITTLE_ENDIAN
#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 1774a5c..eb9eda8 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -214,7 +214,9 @@ typedef int __bitwise snd_pcm_format_t;
#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
-#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_G723_40_1B
+#define SNDRV_PCM_FORMAT_DSD_DOP_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD DOP format (x8) */
+#define SNDRV_PCM_FORMAT_DSD_DOP_U16 ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD DOP format (x16) */
+#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_DOP_U16
#ifdef SNDRV_LITTLE_ENDIAN
#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 578327e..578a761 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -209,6 +209,8 @@ static char *snd_pcm_format_names[] = {
FORMAT(G723_24_1B),
FORMAT(G723_40),
FORMAT(G723_40_1B),
+ FORMAT(DSD_DOP_U8),
+ FORMAT(DSD_DOP_U16),
};
const char *snd_pcm_format_name(snd_pcm_format_t format)
--
1.8.1.4
next reply other threads:[~2013-04-06 11:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-06 11:44 Daniel Mack [this message]
2013-04-06 11:44 ` [PATCH 2/2] ALSA: snd-usb: add quirks handler for DSD streams Daniel Mack
2013-04-06 11:44 ` Daniel Mack
2013-04-06 11:48 ` Daniel Mack
2013-04-06 17:53 ` [PATCH 1/2] ALSA: add DSD formats Jussi Laako
2013-04-06 17:59 ` Daniel Mack
2013-04-06 21:56 ` Jussi Laako
2013-04-06 23:07 ` Jussi Laako
2013-04-07 7:35 ` Takashi Iwai
-- strict thread matches above, loose matches on Subject: below --
2013-03-27 23:30 Daniel Mack
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=1365248693-27867-1-git-send-email-zonque@gmail.com \
--to=zonque@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=andreas@akdesigninc.com \
--cc=clemens@ladisch.de \
--cc=demian@auraliti.com \
--cc=jussi@sonarnerd.net \
--cc=ray@auraliti.com \
--cc=tiwai@suse.de \
/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