ALSA: pcm: add new DSD sampleformat for native DSD playback on XMOS based devices
authorJurgen Kramer <gtmkramer@xs4all.nl>
Fri, 5 Sep 2014 08:47:56 +0000 (10:47 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 8 Sep 2014 15:11:00 +0000 (17:11 +0200)
XMOS based USB DACs with native DSD support expose this feature via a USB
alternate setting. The audio format is either 32-bit raw or a 32-bit PCM format.
To utilize this feature on linux this patch introduces a new 32-bit DSD
sampleformat DSD_U32_LE.
A follow up patch will add a quirk for XMOS based devices to utilize the new format.
Further patches will add support to alsa-lib.

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/pcm.h
include/uapi/sound/asound.h
sound/core/pcm.c
sound/core/pcm_misc.c

index 67e0bdb9f0fa3fda8bffb8882af8e1f6e7cd8dde..e862497f75568d11cd4deb4f5f5a06712f63d6de 100644 (file)
@@ -183,6 +183,7 @@ struct snd_pcm_ops {
 #define SNDRV_PCM_FMTBIT_G723_40_1B    _SNDRV_PCM_FMTBIT(G723_40_1B)
 #define SNDRV_PCM_FMTBIT_DSD_U8                _SNDRV_PCM_FMTBIT(DSD_U8)
 #define SNDRV_PCM_FMTBIT_DSD_U16_LE    _SNDRV_PCM_FMTBIT(DSD_U16_LE)
+#define SNDRV_PCM_FMTBIT_DSD_U32_LE    _SNDRV_PCM_FMTBIT(DSD_U32_LE)
 
 #ifdef SNDRV_LITTLE_ENDIAN
 #define SNDRV_PCM_FMTBIT_S16           SNDRV_PCM_FMTBIT_S16_LE
index 32168f7ffce3ce03fe19bb8f187cfb6321710976..6ee586728df97a0fc335a3c314e0828ac970023f 100644 (file)
@@ -219,7 +219,8 @@ typedef int __bitwise snd_pcm_format_t;
 #define        SNDRV_PCM_FORMAT_G723_40_1B     ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
 #define        SNDRV_PCM_FORMAT_DSD_U8         ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
 #define        SNDRV_PCM_FORMAT_DSD_U16_LE     ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
-#define        SNDRV_PCM_FORMAT_LAST           SNDRV_PCM_FORMAT_DSD_U16_LE
+#define        SNDRV_PCM_FORMAT_DSD_U32_LE     ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
+#define        SNDRV_PCM_FORMAT_LAST           SNDRV_PCM_FORMAT_DSD_U32_LE
 
 #ifdef SNDRV_LITTLE_ENDIAN
 #define        SNDRV_PCM_FORMAT_S16            SNDRV_PCM_FORMAT_S16_LE
index afccdc553ef9c3e22abfeaa1e73a8dd308e6a392..42ded997b223b7ece3d8535000d4defeea2ba8f5 100644 (file)
@@ -215,6 +215,7 @@ static char *snd_pcm_format_names[] = {
        FORMAT(G723_40_1B),
        FORMAT(DSD_U8),
        FORMAT(DSD_U16_LE),
+       FORMAT(DSD_U32_LE),
 };
 
 const char *snd_pcm_format_name(snd_pcm_format_t format)
index 4560ca0e5651ac6c515c589efa18fc8d308b1910..83f54e1dbac90adedc2a633c60dae2bc50efe42b 100644 (file)
@@ -148,6 +148,10 @@ static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = {
                .width = 16, .phys = 16, .le = 1, .signd = 0,
                .silence = {},
        },
+       [SNDRV_PCM_FORMAT_DSD_U32_LE] = {
+               .width = 32, .phys = 32, .le = 1, .signd = 0,
+               .silence = { 0x69, 0x69, 0x69, 0x69 },
+       },
        /* FIXME: the following three formats are not defined properly yet */
        [SNDRV_PCM_FORMAT_MPEG] = {
                .le = -1, .signd = -1,